Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Error loading DLL


3 replies to this topic

rags33

rags33
  • Members
  • 15 posts

Posted 17 January 2002 - 02:15

I have a dll A and I call functions within the dll A. This dll A uses another dll B. When I try to load A it fails. I have both A & B in the same directory.

When I look into dependencies IS is trying to load dll B from c:\winnt\system32? Why????


Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 17 January 2002 - 03:28

Well that (system32) is in the path, but I'm not sure why it's using that.  I would think the local directory would take precedence.  I've not worked loading DLLs under IS though, so I really have no idea.  Sorry.

(Edited by TacoBell00 at 9:29 pm on Jan. 16, 2002)


KathyMorey

KathyMorey
  • Full Members
  • 111 posts

Posted 18 January 2002 - 17:14

I haven't done this with dependent dll's personally, but I seem to remember discussion about using ChangeDir first to make sure that the directory the dll's are in is the current directory.

HTH
Kathy


clvrmnky

clvrmnky
  • Members
  • 27 posts

Posted 18 January 2002 - 18:02

UseDLL() will not find shared DLLs in the same directory.  DLLs are found in one of three ways:

1. In the "current directory"
2.In the standard system areas
3. on the PATH environment

To make sure your install works without depending on the PATH, and for a DLL that is not in WINSYSDIR, do one of the following:

1. Use ChangeDirectory() to make the current working directory the same as where the shared DLL lives.  i.e.: ChangeDirectory(SUPPORTDIR).

2. Load the DLL in the right order.  That is, if you have A.dll that depends on B.DLL, then you would:

UseDLL("B.DLL");
UseDLL("A.DLL");
[...]
UnuseDLL("A.DLL");
UnuseDLL("B.DLL");

If you have further need of exported function calls, you would call that DLL first, and so on.

Both methods work for me, but (1) seems more robust.  Having the CWD set to SUPPORTDIR does not seem to affect the install's cleanup at the end of the process.