Board index » delphi » De{*word*81} Kernel Error : Error code: 1 when importing a function from a dll

De{*word*81} Kernel Error : Error code: 1 when importing a function from a dll

I get the above message when attmpting to run (F9) a delphi program with the
following line of code

function Add( Value1, Value2 : longint ): longint; cdecl;
                        external 'ADDER.DLL' index 1;

Variations on the above including referencing by name instead of index give
the same result.
Anyone care to enlighten me?

Thanks

Martin Welford

 

Re:De{*word*81} Kernel Error : Error code: 1 when importing a function from a dll


Martin,

Quote
> welfo...@fp.co.nz (Martin Welford) wrote in article =

<4odu0u$...@ren.fp.co.nz>...

Quote
> I get the above message when attmpting to run (F9) a delphi program =
with the=20
> following line of code
>=20
> function Add( Value1, Value2 : longint ): longint; cdecl;
>                         external 'ADDER.DLL' index 1;

In Win32, and so Delphi2, you should import functions from 32 bit DLL's
using the stdcall calling convention (Delphi's default is fastcall).
So your declaration should read:

 function Add( Value1, Value2 : longint ): longint; stdcall;
                         external 'ADDER.DLL' index 1;
Hope this helped,

--=20
-------------------------------------------------------------------------=
-
Daniel Polistchuck      Systems Analyst
dan...@pobox.com       Technology Group
                        Simples Information Technology
                        dan...@simples.com.br
-------------------------------------------------------------------------=
-

Other Threads