Solved

Windows NT and DLL problem

Posted on 1998-12-22
6
186 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
  • 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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
delphi exception 7 68
update joined tables 2 55
RESTRequest Parameter 4 43
delphi popmenu non latine charcters 3 13
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

830 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