Solved

Windows NT and DLL problem

Posted on 1998-12-22
6
192 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

696 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