[fpc-devel]Error Delphi load DLL, when DLL created in FPC

Rimgaudas Laucius rimga at ktl.mii.lt
Thu Nov 21 17:07:36 CET 2002


> > Subject: [fpc-devel]Error Delphi load DLL, when DLL created in FPC
> > Reply-To: fpc-devel at lists.freepascal.org
> >
> > Hi,
> >   I have problem when I create DLL in FPC. (FPC 1.06 Win32)
> >   1.When create DLL in FPC and use it in program written in FPC - it
works
> > OK.
> >   2. The same DLL (created in FPC) and use in Delphi (6.0) - Delphi
report
> > error when loading DLL.
> >
> > What I can do, to write DLL in FPC and use it in Delphi.
> > It's very strange for me, because both use teh same function to Load
> DLL ->
> > LoadLibrary!
> >
> > Best regards
> >     Zb. Kuczbanski
> >
> >
> > Here sample code my_dll.
> > ----------------------------------------------
> > Library my_dll;
> > Begin
> >    WriteLn('Loaded DLL1');
> > End.
>
> OK, it is no important, what do DLL, I check it for new code of  DLL.
> Library DLL1;
> uses Sysutils;
> var F: LongInt;
>     szStr  : array[0..100] of Char;
> Begin
>    F:=FileCreate('Dll1.log');
>    strcopy(szStr,'Dll1 is loaded');
>    FileWrite(F,szStr,StrLen(szStr));
>    FileClose(F);
> End.
>
> When this DLL load program written in Delphi, it show Error (function
> LoadLibrary)
> In my opinion situation similar to show in Bug 2232.
> I check this bug, when both DLL created in Delphi. In this case both DLL
> loaded corecctly!
>
> What I can do, to write DLL in FPC and use it in Delphi.
>     Zb. Kuczbanski

I can confirm that there are problems with fpc dll loading from delphi
program. I noticed that some dlls dinamicaly loads in delphi, but then i
tryed to load them staticaly (with "external") program stoped responding in
its initialization state. I noticed these problems ealier, but failed to
locate them clearly. I think there might be the same problems as mentioned
here.





More information about the fpc-devel mailing list