I believe you must use extern "C" also; C++ compilers garble function names.
That would only be true if he used C++ compilation. The use of the .c
extension would cause C compilation where extern "C" would be invalid.
If you built mystuf.a, as an export library you also need to have built the
DLL. If you built it as a static library, the DLL is irrelevant (and you don't
then need LibMain() either). Post the compile log of the DLL build (for a
"Rebuild All"), and the application you are trying to link with the library.
You don't call LibMain() directly - the OS does that when it loads the library
at run time, so it need not be in the header, but even if it were it would not
matter if you did not call it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello
I try to write code to port a old project writted with LCC to DEV-C++
I have a main.c file that include a header <mystuf.h> located in a sub-directory of include/
This header contain
__declspec(dllexport) _cdecl BOOL LibMain(...)
I also have a file mystuf.c with the corresonding code, I also have compiled it to mystuf.a that is in a sub-directory of lib/
I tried to add __declspec(dllexport) _cdecl BOOL LibMain(...) in main.c
My problem is that my function LibMain never appear in my DLL (I look with "depends" utility).
Many thanks for helping me
I believe you must use extern "C" also; C++ compilers garble function names.
That would only be true if he used C++ compilation. The use of the .c
extension would cause C compilation where extern "C" would be invalid.
If you built mystuf.a, as an export library you also need to have built the
DLL. If you built it as a static library, the DLL is irrelevant (and you don't
then need LibMain() either). Post the compile log of the DLL build (for a
"Rebuild All"), and the application you are trying to link with the library.
You don't call LibMain() directly - the OS does that when it loads the library
at run time, so it need not be in the header, but even if it were it would not
matter if you did not call it.
To load a function from a DLL in Windows, use LoadLibrary() together with
function pointers.
hi,
sorry i have no about of this so i can not reply, i also need suggestions
pl. send a message
i appreciated for urs message
thanks in advance
regards,
phe9oxis,
http://www.guidebuddha.com