[fpc-pascal]GNU Scientific Library

A.J. Venter ajventer at direqlearn.org
Fri Dec 6 07:48:21 CET 2002

Decide first if you need to translate the headers.

If you are only going to use a few functions, then I reccomend simply 
declaring them as externals and using them. In fact translating a header file 
does just that - it merely extends this by defining variables as pascal 
variables (nothing hard about that) and by declaring ALL the functions.

See the chapter on interoptabillity in the FPC users guide for a full 
discussion on linking issues and external declarations.

A.J. Venter
On Wednesday 04 December 2002 10:07 pm, Ramom Flores d'as Seixas wrote:
> Hi:
>     I'm trying to use the Gnu Scientific Library (GSL) that is written in
> "C". Unfortunately my knowledge of C is very limited. This library looks
> like very interesting and has a lot of functions, but it has also a lot of
> nested include  files with a myriad of type definitions. So I'm asking your
> help.
> Are there any document explaining how to translate .h files to units? or
> perhaps a C -> Pascal tutorial?
> I know the h2pas tool, and I have used it, but I have some dudes how to use
> it. Following are some of them:
> 1) How many *.h files need to be translated?
>  First I would like to use the minimization stuff that is presented in
> the file: "gsl_multimin.h", and in this file there are 5 includes:
> one standard, stdlib.h and for specific of gsl: gsl_math.h, gsl_vector.h,
> gsl_matrix.h, and gsl_min.h. But these include files call others include
> files, for example gsl_math.h calls math.h (C standard), gsl_sys.h,
> gsl_machine.h, gsl_precision.h, gsl_nan.h and gsl_pow_int.h.
> So translate all the nested include files is a titanic work, that exceeds
> my forces. It is possible just translate some of them, which ones?
> 2) How translate "general" arrays? (Arrays without index).
> For example in the file gsl_precision.h appears the following declaration:
>         extern const double gsl_prec_eps[ ];
> that is translated by h2pas as:
>         gsl_prec_eps : array of double;cvar;external;
> but I think this declaration is not correct pascal.
> 3) What is the equivalent type of "size_t" in pascal? (I think that is a
> integer type).
> Cheers
>         Ramom
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Programming  n.
First defined by Shakespear as: "Bloody instructions which, being taught 
return to plague their inventor" (Macbeth, Act 1, Scene 7)

More information about the fpc-pascal mailing list