Solved

Windows NT and DLL problem

Posted on 1998-12-22
6
189 Views
Last Modified: 2010-04-04
   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...
0
Comment
Question by:guvencum
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 3

Accepted Solution

by:
williams2 earned 50 total points
ID: 1352547
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
 
LVL 3

Expert Comment

by:williams2
ID: 1352548
..so I forgot:

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

:-)

Cheers,
Williams
0
 
LVL 3

Expert Comment

by:philipleighs
ID: 1352549
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 12

Expert Comment

by:rwilson032697
ID: 1352550
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
 
LVL 3

Expert Comment

by:philipleighs
ID: 1352551
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
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1352552
Ouch - that hurts :-)

Cheers,  Raymond.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

736 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question