CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2003
    Location
    Kinmen Of R.O.C
    Posts
    6

    Question Where should the dll be put?

    I build a dll of hook
    but i discover that
    I can put it at many dirs
    and run it success

    for a example...
    my exe at
    C:\abc\def\exe.exe

    I can run it success when the dll at

    C:\abc\hook.dll
    C:\abc\def\hook.dll
    C:\window\hook.dll

    why?
    my exe and dll at different dirs
    why I can run it success?

    there are so many dirs I can put and run success!!
    than....where should i put the dll????

  2. #2
    Join Date
    May 2002
    Location
    Somewhere over the rainbow
    Posts
    423
    usually in the same dir or your exe ,
    but most of them are in the windows\system32
    or in the winnt\system32
    Bengi

  3. #3
    Join Date
    Dec 2001
    Location
    Dallas, Tx, USA (originally fromIndia)
    Posts
    154
    i guess you can put it anywhere.
    I put the one i am using in my folder and used regsvr32 to register the dll.
    So i guess it depends on your dll and where u want to put it.
    Regards,
    Preetham.
    "All you touch and all you see is all you'll ever be"

  4. #4
    Join Date
    Jan 2002
    Location
    TamilNadu, India
    Posts
    158
    That depends on what kind of dll you are creating.
    If I create a COM dll, then the registration is thru regsvr32. I can keep this dll anywhere in the machine.

    If I have to create a win32 dll and use it via LoadLibrary method, regsvr32 is not necessary. In this case, if you don't specify a complete path, the program will try to search in the current path/windows/system32 etc.,
    Muthu

  5. #5
    Join Date
    Apr 2003
    Location
    Kinmen Of R.O.C
    Posts
    6
    oh....
    thank you a lot
    now i know that why it can run success when the dll and prog at different dirs
    My Msn : [email protected]
    My Web : http://www.kinmen.info/vic

  6. #6
    Join Date
    Jun 2002
    Posts
    185
    This is taken from MSDN

    The Search Path Used by Windows to Locate a DLL
    Home | Overview | How Do I | FAQ | Details | Sample

    With both implicit and explicit linking, Windows first searches the set of pre-installed DLLs such as the performance library (KERNEL32.DLL) and the security library (USER32.DLL). Windows then searches for the DLLs in the following sequence:

    The directory where the executable module for the current process is located.


    The current directory.


    The Windows system directory. The GetSystemDirectory function retrieves the path of this directory.


    The Windows directory. The GetWindowsDirectory function retrieves the path of this directory.


    The directories listed in the PATH environment variable.
    Note that the LIBPATH environment variable is not used.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured