[fpc-pascal] Resending: Trying to convert some C code

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Tue Nov 7 12:42:02 CET 2006


ops .. only now I saw this.

You don't need to encapsulate the procedure variable inside a real
procedure. You can call a procedure variable, like if it was a
procedure.

Try this code:

Unit bn;

{$MODE DELPHI}{$H+}
{$packrecords c}

interface

uses ctypes, DynLibs;

type
  bignum_st = record
    d: pointer;
    dmax: cint;
    neg: cint;
    flag: cint;
  end;

  BIGNUM = bignum_st;

  PBIGNUM = ^BIGNUM;

  TBN_bn2hex = function (a: PBIGNUM): PChar; cdecl;

var
  BN_bn2hex: TBN_bn2hex;

function InitLib: Boolean;

implementation

Function InitLib: boolean;
Begin
  LibHandle := LoadLibrary('libeay32.dll');
  Pointer(BnBn2Hex) := GetProcAddress(LibHandle, 'BN_bn2hex');
  result := true;
End;

end.



More information about the fpc-pascal mailing list