Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dll Calling Problems

Status
Not open for further replies.

cascot

Programmer
Jan 30, 2002
127
CA
I developed a dll using Delphi 7.0. I call the dll from a Microsoft Access database. On my own machine, running Windows XP Pro and Microsoft Access 2000, the dll works precisely as intended, however when I place it on the server it was designed to work on, nothing appears to happen. The server is also running Windows XP Pro and
Microsoft Access 2000.


I'm new to Delphi and to this kind of development (dlls). Can anybody tell me the best way to debug (so to speak) this scenario to find out exactly what is happening (or not happening as the case may be), or maybe any problems anyone is aware of that could prevent a called dll from actually functioning?

Thank you.
 
maybe you need MDAC components on your server. these are autoinstalled with access.

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
whosrdaddy,

Thanks for your reply.

Access 2000 is installed on the server, so the MDAC components should already be in place.
 
A thought: do you have a path issue (where the app can't find the dll)?

No messages that indicate a problem, just nothing happens? How are you loading the DLL (static or dynamic)?

Some good questions to start out on.
 
Glenn9999

Thanks for your reply.

There are no error messages of any kind. The dll is meant to search out a dialog box and click a button on it.

The dll is linked dynamically. I didn't think you could statically link a dll (hence the name)??

 
Okay, maybe I'm not using the right words, but they seem to fit for what I'm thinking. The difference is whether it occurs as part of the program loading process or as part of the code itself. I just look now and see that the manual uses the word "importing".

Static importing of a DLL:
Code:
procedure trigger_sort(parmblock: sortparmptr);far;external 'sort4.dll';

Dynamic importing of a DLL (from the help):
Code:
program ShowTime;
uses Windows;
type
 TTimeRec = record
   Second: Integer;
   Minute: Integer;
   Hour: Integer;
 end;
 TGetTime = procedure(var Time: TTimeRec);
var
 Time: TTimeRec;
 Handle: THandle;
 GetTime: TGetTime;
begin
 Handle := LoadLibrary('DATETIME.DLL');
 if Handle <> 0 then
 begin
   @GetTime := GetProcAddress(Handle, 'GetTime');
   if @GetTime <> nil then

   begin
     GetTime(Time);
     with Time do
       WriteLn('The time is ', Hour, ':', Minute, ':', Second);
   end;
   FreeLibrary(Handle);
 end;
end;

Hopefully that will help clarify what I was looking for - as you can see, the debug path and next questions to ask would be much different depending on what paths you are taking.
 
Glenn9999

Thank again for your continued help.

Whilst I coded the dll using Delphi 7.0, as I mentioned in my initial posting, the dll is being called from within a Microsoft Access database, so using VBA code.

I believe the dll will be loaded at program start-up.

 
okay, I think I see....

Are you using the expected conventions for Microsoft Access in your DLL? Like specifying STDCALL access by putting "stdcall" in the procedure header?

 
Glenn9999,

Yes I use the stdcall as follows:

Code:
Procedure CloseDlg(DlgStage : Integer); StdCall;
begin
  TDialogDestroyer.Create(DlgStage);
end;

As I mentioned in my initial post, the entire process works perfectly on my own development machine (Windows XP Pro with Microsoft Access 2000), so I know the fundamentals are correct. But when I "install it" on the server (also running Windows XP Pro and Microsoft Access 2000), nothing happens when the dll procedure is called.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top