I want it to create dll and LIB. because this dll is statically linked to another CPP dll. so I must have the lib file.
i'm using the IDE of delphi 4
I want it to create dll and LIB. because this dll is statically linked to another CPP dll. so I must have the lib file.
i'm using the IDE of delphi 4
No, Delphi does not generate lib files. It has no use for them.
There are ways to create a lib file from a DLL. For example, you can use implib, if it came with your version of Delphi.
Using in C++ DLLs created in Delphi (as vice-versa) is pretty easy, but you need to follow simple rules. I assume you are trying to use Delphi DLL in C++ project:
You must use the same calling convention. By default, Delphi uses register convention (__fastcall in C++ terminology). Default calling convention for all Windows DLLs is __stdcall, so first modify the function declaration in your Delphi source file as follows:
function DoSomething(x, y: Integer): Integer; stdcall;
When you use __stdcall, C++ expects exported functions in the DLL to have the names followed by the postfix designating the overall size of the params passed to it. Thus, your DoSomething routine should become DoSomething@8, taking into account that the size of Integer is 4 bytes and your exports section in the .dpr file should look like:
exports
DoSomething name 'DoSomething@8'
Create C++ header with function declaration and include it to your C++ project:
int _declspec(dllimport) _stdcall DoSomething(int x, int y);
If you use C++ Builder or Visual C++, utilize implib utility which creates import library (.lib). There is also a lib tool coming with VC++ which can do the same. Then link with that .lib file instead of .dll.