Difference D4 vs D5...
Hello,
I'm writing a DLL, which in turn calls another DLL(third-party).
The DLL is supposed to create a special file type, using the third-party
DLL.
If I build my DLL in D4, everything works perfectly (My result file works
fine), yet if I build it in D5 (No changes at all), my DLL creates a
corrupted file.
My guess is, that there is a difference between D4 and D5 in calling a DLL
with LoadLibrary.
Here are some code snippets.... Hope someone can figure this out.
unit Unit2;
interface
uses windows, mapi ;
file://Procedures to handle dynamic loading of migrid.dll
procedure OpenDLL;
procedure CloseDll;
type
TCreateFile= function(Handler : HWND; Filename : pchar;dMaxVal :double):
boolean ; stdcall;
var
CreateFile: TCreateFile;
implementation
procedure OpenDLL;
var Handle:Integer;
begin
Handle := LoadLibrary(Pchar(ThirdPartyDir + 'Special.dll'));
if Handle <> 0 then
begin
@CreateFile:= GetProcAddress(Handle, 'CreateFile');
end;
end;
procedure CloseDLL;
var Handle:Integer;
begin
Handle := LoadLibrary(Pchar(ThirdPartyDir + 'Special.dll'));
if Handle <> 0 then
begin
FreeLibrary(Handle);
end;