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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems in a DLL loading a second DLL.

Status
Not open for further replies.

prebbe

Programmer
Jul 24, 2007
1
NO
I have simplified this code a little bit so it would be easier to see:

*********************************
library lea;

uses
ShareMem,
SysUtils,
Classes,
Dialogs,
Windows;

const
cLines = 10;
cLetters = 30;

function TrInitTransportDriver(s: PChar):integer; stdcall; external 'Transport.dll';
function TrSetDevice(i: Integer):integer; stdcall; external 'Transport.dll';

function WriteToDisplay(var data: string):boolean; export;
begin
TrSetDevice(0);
TrInitTransportDriver('UsbDevice.ini');
TrSetDevice(0);
end;

Exports
WriteToDisplay

{$R *.res}

begin
end.
************************************

Ok. The problem is that when i run this code and the function WriteToDisplay, the 'TrSetDevice(0)'-code is executed as i could expect. But when i come to the next line a problem occurs. In the debugger i jump from the code up to the top where TrInitTransportDriver is defined(just as expected). And at the next step i suddenly jump all the way to 'end;' in the code in the exe. (At the bottom of where the quoted dll is dynamically loaded).

Anyone?

I just checked GetLastError and the result was: '2' which means something about file not found, so i guess that this error has nothing to do with my code, but is an error from something else. Aboslutely all my files are in one single folder. I have checked with "Dependencies Walker" that my dlls have all dependencies needed.
 
I just checked GetLastError and the result was: '2' which means something about file not found, so i guess that this error has nothing to do with my code, but is an error from something else. Aboslutely all my files are in one single folder. I have checked with "Dependencies Walker" that my dlls have all dependencies needed.

Is 'UsbDevice.ini' in the same folder as 'Transport.dll'?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top