Thread: Using MFC based DLL with C only exe

  1. #1
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868

    Using MFC based DLL with C only exe

    I am trying to load a DLL made with MFC into my WIN32 API exe written with C (uses .c not .cpp)
    Can load DLL but fails to find the functions as they are classes. GetProcAddress fails to find them and I can't declare them as I would if they were C type functions.

    Anyone know a way round? I remember a __C something I should be putting somewhere.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    I honestly don't know if this is what you're looking for but perhaps the ms specific:

    __declspec( dllimport ) declarator

    __declspec( dllexport ) declarator

    May help?
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #3
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Still can't get more than one function to link, with or without the library.

    Will rebuild DLL without MFC as I have the source.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Found the problem.

    The prototypewas declared in the source NOT in the header files. On linking they could not be found.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  5. #5
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Congrats! And thanks for sharing. Sorry, too, if my 'guess' distracted you from your eventual solution.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. MFC based paint
    By c.zdravko in forum Windows Programming
    Replies: 4
    Last Post: 02-18-2008, 09:11 AM
  2. Error C2664 - Trying to call an external Dll
    By jamez05 in forum C++ Programming
    Replies: 3
    Last Post: 08-08-2006, 06:07 AM
  3. DLL version MFC app
    By Unregistered in forum Windows Programming
    Replies: 0
    Last Post: 07-30-2002, 07:22 PM
  4. MFC Dialogue based Prog NEED HELP PLEASE
    By frgmstr in forum Windows Programming
    Replies: 4
    Last Post: 02-13-2002, 04:23 PM
  5. MFC: Multi-threaded DLL Errors & Related Syntax :: C++
    By kuphryn in forum C++ Programming
    Replies: 3
    Last Post: 02-13-2002, 09:02 AM