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

Ole J. Røtne ole.rotne at online.no
Tue Nov 7 13:27:21 CET 2006



Will try this to , thanks for the tip :)

> -----Opprinnelig melding-----
> Fra: fpc-pascal-bounces at lists.freepascal.org 
> [mailto:fpc-pascal-bounces at lists.freepascal.org] På vegne av 
> Felipe Monteiro de Carvalho
> Sendt: 7. november 2006 12:42
> Til: FPC-Pascal users discussions
> Emne: Re: [fpc-pascal] Resending: Trying to convert some C code
> 
> 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.
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org 
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> 
> 




More information about the fpc-pascal mailing list