Exetools

Exetools (https://forum.exetools.com/index.php)
-   General Discussion (https://forum.exetools.com/forumdisplay.php?f=2)
-   -   How create Static Library (lib) in delphi? (https://forum.exetools.com/showthread.php?t=13825)

Newbie_Cracker 10-20-2011 03:09

How create Static Library (lib) in delphi?
 
Hello everybody.


I have a delphi DLL code and want to create a LIB for it to use the code directly in my EXE in VC++. I don't want to have separate DLL file.

I searched the net and could not find anything useful. Do you know the solution?

I know there is a program named DLL2LIB, but I don't want to use it, as it's shareware (but cracked by myself).

Best regards.

Kerlingen 10-20-2011 04:37

Delphi cannot create *.LIB files. The only way to do something similar is to tell Delphi to generate C++ compatible *.OBJ files (check the "-J" command line switches) and link them. Delphi can only output to OMF format, not COFF. The best choice is probably to use C++ Builder instead of Visual C++.

Why don't you want to use DLLs? They don't have a real disadvantage and there are many programs available which "bundle" DLLs with the EXE files.

Newbie_Cracker 10-20-2011 14:19

Quote:

Originally Posted by Kerlingen (Post 75458)
Why don't you want to use DLLs?

To minimize dependencies.

Assume that your patcher needs a DLL to play a chiptone!!
It's so crazy to release a DLL and EXE for something like this.

Nacho_dj 10-20-2011 15:46

You'd rather use DLL2LIB. That's the way condzero is using the Delphi code of ARImpRec.dll (Delphi dll) in Armageddon (VC++) by the use of a .lib file generated by the tool, and this works fine.

Btw, to give compatibility to your exported functions in the Delphi dll, you have to give this name to all of them:
<NameOfExportedFunction>@<NumberOfBytesInParameters>

That is, if your function uses for instance 4 parameters of size dword, the number must be: SizeOf(dword) * 4 --> 16

So, the name of your exported function would be this:

MyExportedFunction@16


Good luck with this!

Nacho_dj

SLV 10-20-2011 20:35

> Btw, to give compatibility to your exported functions in the Delphi dll, you have to give this name to all of them:
Don't forget that delphi compiles routines as fastcall, so it's better to set stdcall to all exports. I\m not sure that delphi fastcall == cl.exe fastcall.

oVERfLOW 10-21-2011 23:39

Look at this old topic that may help you

or if being able to contact magic_h2001 and ask him about complete steps needed
Code:

http://forum.exetools.com/showthread.php?t=11019
Edit
here is his website
you may find his E-Mail address at the bottom of page

TQN 10-22-2011 00:43

You can embedded your dll to resource section or data section, and use the MemoryModule to dynamic load it to memory, don't need to extract to a temp file.
MemoryModule here: https://github.com/fancycode/MemoryModule

If someone uses Delphi, search for BTMemoryModule, a Delphi port form MemoryModule above.

Newbie_Cracker 10-26-2011 22:33

Quote:

Originally Posted by TQN (Post 75480)
You can embedded your dll to resource section or data section, and use the MemoryModule to dynamic load it to memory, don't need to extract to a temp file.
MemoryModule here: https://github.com/fancycode/MemoryModule

If someone uses Delphi, search for BTMemoryModule, a Delphi port form MemoryModule above.

Some AVs don't like this. I don't want to have false+.


All times are GMT +8. The time now is 11:59.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX