Using MFC based DLL with C only exe

This is a discussion on Using MFC based DLL with C only exe within the Windows Programming forums, part of the Platform Specific Boards category; I am trying to load a DLL made with MFC into my WIN32 API exe written with C (uses .c ...

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

    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,856
    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,856
    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, 08: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, 03:23 PM
  5. MFC: Multi-threaded DLL Errors & Related Syntax :: C++
    By kuphryn in forum C++ Programming
    Replies: 3
    Last Post: 02-13-2002, 08:02 AM

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