Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2002-12

GNU Scientific Library

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Ramom Flores d'as Seixas

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

A.J. Venter
to Ramom Flores d'as Seixas

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.

Ciao
A.J. Venter

Ramom Flores d'as Seixas wrote 44 lines
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 - 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)