Menu

DLL __declspec(dllexport)

2008-11-26
2012-09-26
  • www.BoumPower.ch

    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

     
  • anonymous nobody

    I believe you must use extern "C" also; C++ compilers garble function names.

     
  • cpns

    cpns - 2010-01-30

    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.

     
  • anonymous nobody

    To load a function from a DLL in Windows, use LoadLibrary() together with
    function pointers.

     
  • laxman varada

    laxman varada - 2010-08-16

    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

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.