[fpc-pascal] Becoming crazy with dll
Michel Meunier
michel.meunier100 at wanadoo.Fr
Tue Jan 23 16:27:38 CET 2007
Hello,
I try to translate a dll from delphi to fpc, but I have a lot of
problem. First I am unable to load it with loadlibrary.
the code of the library is:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
library dlltest;
{$mode objfpc}{$H+}
uses
Classes
{ add your units here }, dlltestUnit;
exports
AskForExecuteCCDCommand name 'AskForExecuteCCDCommand';
begin
end.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
and the unit associate is:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
unit dlltestUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils;
const
MaxCommand=100;
type
// Param structures that is used to pass the data
// 32 bits Alignement
TParamCCD = record
NbreParam: Integer;
Param: array[0..MaxCommand - 1] of Pchar;
end;
PParamCCD = ^TParamCCD; // Pointer
procedure AskForExecuteCCDCommand(ParamCCDInt, ParamCCDOut: PParamCCD);
stdcall; // C-C++ calling conventions
implementation
procedure AskForExecuteCCDCommand(ParamCCDInt, ParamCCDOut: PParamCCD);
stdcall; // C-C++ calling conventions
begin
end;
end.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
next in a small programm I try to load the library, but the handle is
allways 0. The part with the code is:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Var HandleDLL:Integer;
begin
HandleDLL := LoadLibrary('dlltest.dll');
if HandleDLL <> 0 then
begin
showmessage('ok');
showmessage(inttostr(HandleDLL));
end
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Thanks a loy for your help, I am becoming crazy with that!
--
Michel Meunier
Web: www.etoiles-a-bleau.fr
More information about the fpc-pascal
mailing list