Dll Export in C++

This is a discussion on Dll Export in C++ within the C++ Programming forums, part of the General Programming Boards category; Hello, I've encountered a strange behavior in __declspec(dllexport) in my project. I have a C++ project that uses classes, namespaces, ...

  1. #1
    Registered User
    Join Date
    Apr 2010
    Posts
    2

    Lightbulb Dll Export in C++

    Hello,

    I've encountered a strange behavior in __declspec(dllexport) in my project.
    I have a C++ project that uses classes, namespaces, try-catches and more cpp elements.
    When exporting any dummy function in this DLL, no other C project will be able to load it with LoadLibrary (Getting error 'module not found').

    Is it possible to load dynamically C++ dlls through C projects?
    These projects are Windows Mobile projects, but they should behave the same as on regular PC win32.

    I'm stuck on it and any help will be appreciated.

    Thank you,
    Emil.

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    If you want to use them in C projects, you still, IIRC, need to make them extern "C", otherwise you will get the name mangling that C++ does to allow overloaded functions.

  3. #3
    Registered User
    Join Date
    Apr 2010
    Posts
    2
    I export just one function: extern "C" __declpesc(dllexport) int test();
    and I can't even get to GetProcAddress... LoadLibrary give an error.
    If I comment this function, and I don't have any export, then LoadLibrary works great.
    So it's probably a problem with the settings of the projects or C-C++ compatibility.

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Well, what does GetLastError say the problem is?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Dll Export table
    By P4R4N01D in forum Windows Programming
    Replies: 7
    Last Post: 04-08-2008, 10:41 PM
  2. DLL Export List
    By Yarin in forum C++ Programming
    Replies: 4
    Last Post: 09-14-2007, 03:01 AM
  3. dll communicating between each other
    By cloudy in forum C++ Programming
    Replies: 5
    Last Post: 06-17-2005, 03:20 AM
  4. How to export dll function for VB
    By joeyzt in forum C++ Programming
    Replies: 0
    Last Post: 01-31-2005, 12:33 PM
  5. DLL and std::string woes!
    By Magos in forum C++ Programming
    Replies: 7
    Last Post: 09-08-2004, 01:34 PM

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