Menu

DLL entry point bypass?

2002-11-07
2012-09-26
  • Nobody/Anonymous

    Hello all,
    I have a DLL that compiled and worked fine from MSVC++6. After compiling from Dev-Cpp 4.9.6 with GCC 3.2 (MinGW) the DllMain function seems to get bypassed. Here's an example :
    (not the actual code)
    //main.cpp

    int a = 1;

    BOOL APIENTRY DllMain(HINSTANCE h, DWORD dwReason, LPVOID pReserved)
    {
    a++;
    return true;
    }

    EXPORT int __cdecl MyFunction()
    {
    return a;
    }

    Calling MyFunction from a program will return 1. If this was compiled with MSVC++6 it would return 2. The difference is critical.

    I've tried combinations of most switches listed under DllTool --help and g++ --help etc.

    Any ideas?

     
    • Nobody/Anonymous

      Ok everyone, you can relax now.

      The problem can be fixed (worked around?) by defining DllMain as

      extern "C" BOOL APIENTRY DllMain(HINSTANCE h, DWORD dwReason, LPVOID pReserved)
      {
      return true;
      }

      geoff (as above)

       

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.