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.
*********************************
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.