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


_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to