Thread: Library not getting loaded...Pls help

  1. #1
    Registered User
    Join Date
    Nov 2006
    Posts
    61

    Library not getting loaded...Pls help

    Library is getting loaded if I hardcode the path
    h=LoadLibrary(C:\\dll\\name.dll);

    However,library is NOT getting loaded...It returns NULL..Pls suggest to fix it.
    <code>
    HINSTANCE h = NULL;
    char * pcDllPath = NULL;
    wchar_t * pwcDllPath =NULL;

    pcDllPath = (*env)->GetStringUTFChars(env, jDllPath, 0);

    pwcDllPath =(wchar_t*)pcDllPath;

    h=LoadLibrary(pwcDllPath); // Debugging shows that pwcDllPath prints the
    // correct path

    /************************************************** ********/

    From java, I have tried by sending following strings:



    C:\\dll\\name.dll



    C:\\\\dll\\\\name.dll


    </code>

    Can you please help me out in this case?

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    If java doesn't translate \\ to \, then you should simply pass
    "C:\dll\name.dll"

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Nov 2006
    Posts
    61
    Still, it is not working. Please suggest

  4. #4
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    When you say "prints the correct path", you mean with one backslash, right?

    And I suppose it has to be said: does C:\dll\name.dll exist and is it readable/openable?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 02-02-2009, 07:27 AM
  2. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  3. Strange error?
    By MrLucky in forum C++ Programming
    Replies: 5
    Last Post: 02-04-2006, 03:01 PM
  4. Strange bunch of DLLs loaded
    By willkoh in forum Windows Programming
    Replies: 2
    Last Post: 09-23-2005, 02:03 PM
  5. Game update...
    By jdinger in forum Game Programming
    Replies: 14
    Last Post: 11-08-2002, 07:10 AM