dll issue

This is a discussion on dll issue within the C++ Programming forums, part of the General Programming Boards category; Hi, I am trying to call functions from a dll without any success. This is the dll setup: Code: #define ...

  1. #1
    Registered User
    Join Date
    Dec 2004
    Posts
    205

    dll issue

    Hi,
    I am trying to call functions from a dll without any success.
    This is the dll setup:
    Code:
    #define DllExport   __declspec( dllexport ) 
    DllExport int _stdcall setupConnection(void) {
    ...
    }
    .def file contains
    LIBRARY communication

    EXPORTS

    setupConnection @1

    in my main program, I set up a pointer to that function as follows:
    Code:
    typedef int (CALLBACK* communication_setup)(void);
    communication_setup comSetup;
    
    
    cDLL = LoadLibrary("communication"); /*Try to open the dll*/
    comSetup = (communication_setup)GetProcAddress(cDLL,"setupConnection");
    Load library works fine. I checked that the code actually goes into the DLLMain function. For some reason the GetProcAddress returns NULL. I also compiled the calling application and the dll using debug mode in ms vs 2005. I am at a lost here. If anybody has an explanation, I'd really appreciate it. Thanks
    Amish
    Last edited by axr0284; 03-23-2006 at 06:57 AM.

  2. #2
    Registered User
    Join Date
    Dec 2004
    Posts
    205
    Figured it out. It would seem that ms vs 2005 was not using the def file when linking the dll. Most probably name mangling was occuring. After forcing it to use the def file using PROPERTIES->LINKER->INPUT, it worked fine.
    Amish

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. non-MFC DLL with MFC app question.
    By Kempelen in forum Windows Programming
    Replies: 10
    Last Post: 08-20-2008, 07:11 AM
  2. DLL Load issue
    By George2 in forum Windows Programming
    Replies: 2
    Last Post: 09-01-2007, 03:42 PM
  3. dll communicating between each other
    By cloudy in forum C++ Programming
    Replies: 5
    Last Post: 06-17-2005, 02:20 AM
  4. dll : design issue!
    By dug in forum C++ Programming
    Replies: 8
    Last Post: 02-17-2005, 10:48 AM
  5. DLL and std::string woes!
    By Magos in forum C++ Programming
    Replies: 7
    Last Post: 09-08-2004, 12:34 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21