I'm having a problem getting a DLL to work. I'm writing the app and the dll in D6. I'm using FastMM4 as the first unit in both the App and the DLL's project uses clause.
The problem is that the DLL is getting garbage for the aFilename parameter. Then the function iLoadandParseFile returns an integer indicating that the file was not found.
I figure that there's something simple that I've overlooked. Help!
DLL function:
App function call:
The problem is that the DLL is getting garbage for the aFilename parameter. Then the function iLoadandParseFile returns an integer indicating that the file was not found.
I figure that there's something simple that I've overlooked. Help!
DLL function:
Code:
uses
FastMM4,
SysUtils,
Classes,
ImportUnit_Sample in 'ImportUnit_Sample.pas' {dm_DB: TDataModule};
function LoadAndParseFile(aFilename: PChar): integer; StdCall;
var
TheFile: string;
begin
if assigned(dm_DB)=False then
dm_DB := Tdm_DB.Create(nil);
TheFile := StrPas(aFilename);
//I have a separate function that does the
//actual work.
result := dm_DB.iLoadandParseFile(TheFile);
end;
App function call:
Code:
function LoadAndParseFile(aFilename: string): integer; external 'DatasetDLL.dll';
procedure LoadTheList;
var
x: integer;
s:string;
begin
s:='c:\django.txt';
x := LoadandParseFile(PChar(s));
end;