Windows NT and DLL problem

   I wrote a DLL in Delphi3 and compiled it under NT
when I run my main program that uses the DLL, it gives me the messsage that "DLL not found c:\winnt;c:\winnt\system;c:\winnt\system32" But in at least one of them DLL exist.
What can be the reason ?
thanks in advance...
guvencumAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
williams2Connect With a Mentor Commented:
That's because you unfortunately have specified a wrong directory for your dll.

Lets say you generate a Project1.dll in the same directory as your main project, let's call it project2.

When loading a dll it should be done like this:

  procedure LoadAndShowDll(Filename: String);
  var
    DllHandle: THandle;
    Init: procedure;
  begin
    DllHandle := LoadLibrary(pChar(Filename));
    if DllHandle <> 0 then
    Begin
      @Init    := GetProcAddress(DllHandle, 'Init');
      Init;
    End;
  End;

Regards,
Williams
0
 
williams2Commented:
..so I forgot:

LoadAndShowDll('C:\Project2.dll'); //Project2 is in the Root of C:\

:-)

Cheers,
Williams
0
 
philipleighsCommented:
If you're declaring a function like this:

function DoYouFeelLuckyPunk: Boolean; stdcall; external 'MYFILE';

then change 'MYFILE' to 'MYFILE.DLL'. Back in the old D1 days, I noticed that you had to supply the extension or the dll was not found. This was only on NT, and was D1. Maybe this is a problem on D3 too?

(BTW: The D3 sources supply the extension)
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
rwilson032697Commented:
Philip: Actually, you could get away without the extension in D1, but in D2 you suddenly needed to include it (something to do with Win32...)

Cheers,

Raymond.

0
 
philipleighsCommented:
OK D2 then, it was just a vague memory. But thank you for the correction. Maybe I'll return the favour the next time there is a unicode question eh? Cheers.
0
 
rwilson032697Commented:
Ouch - that hurts :-)

Cheers,  Raymond.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.