Menu

DLL Load error

Nahall
2009-08-01
2012-09-26
  • Nahall

    Nahall - 2009-08-01

    A Library that was working stopped working.
    I'm using Dev-cpp 5.0 Beta
    A test console program I did confirms it. Here's the testing code:

    include <windows.h>

    include <iostream>

    include <cstdlib>

    using namespace std;

    int main(int argc, char *argv[])
    {
    LPCSTR libName = "../DLL/nhlwnd.dll";
    HINSTANCE lib = LoadLibrary(libName);
    if (lib) {
    cout << "loaded\n";
    FreeLibrary(lib);
    } else cout << "not loaded\n";

    system(&quot;PAUSE&quot;);
    return EXIT_SUCCESS;
    

    }

    The output at runtime: a Windows system MessageBox alerting me that "The application can't be started because 'nhlgraphic.dll' can't be found.

    That's the stuff: nhlgraphic.dll is a dll I made using DevIL library, but that's not called, nor mentioned, nor used in this simple test.

    If I try to load this graphic dll, instead of the one i plugged in the testing code (nhlwnd.dll), it does work.

    Has anyone an idea of what's comin'up??? I'm going slightly mad!

     
    • cpns

      cpns - 2009-08-03

      For the OS to 'know' that 'nhlgraphic.dll' is needed, you must have linked its associated export library to your code. Posting the Compile Log tab text from the build of this code would have indicated whether that was the case.

      Note that if you link an export library, you do not need to also call LoadLibrary() for the same DLL.

      Clifford

       

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.