From: Peter Gerwinski peter@gerwinski.de To: "Nathalie Jarosz" jarosz_n@hotmail.com Subject: Re: beta distribution Date: Wed, 28 Jun 2000 17:41:48 +0200
So I still have some questions... I have tried with a C routine and the pascal unit and program but it doesn't work.
In short: To use functions
extern double foo (double x); extern void bar (void);
Where are these functions and in which form? Is it a C program or do I have to put it in the pascal unit or program?
you write a Pascal unit as follows:
unit FooBar; interface function Foo (x: Real); C; procedure Bar; C; implementation end.
Same questions for this part. Is it a file named FooBar or FooBar.p or something else?...
Then your program can call the functions:
program Something; uses FooBar; begin Bar; writeln (Foo (42)) end.
I guess that if I manage to define correctly the 2 previous parts, it will be ok...
Thanks for help,
Nathalie
________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
29-Jun-00 16:10 you wrote:
From: Peter Gerwinski peter@gerwinski.de To: "Nathalie Jarosz" jarosz_n@hotmail.com Subject: Re: beta distribution Date: Wed, 28 Jun 2000 17:41:48 +0200
So I still have some questions... I have tried with a C routine and the pascal unit and program but it doesn't work.
What exactly you done ? It's really trivial task if you know both C and Pascal and thus it's hard to guess where newbie without C knowleadge can fail...
In short: To use functions
extern double foo (double x); extern void bar (void);
Where are these functions and in which form? Is it a C program or do I have to put it in the pascal unit or program?
It's just sample :-) If you have C library with such functions then you can use them from Pascal. Usually such definitions are in .h file but it does not matter if you plan to use them from Pascal.
you write a Pascal unit as follows:
unit FooBar; interface function Foo (x: Real); C; procedure Bar; C; implementation end.
Same questions for this part. Is it a file named FooBar or FooBar.p or something else?...
Better to use name foobar.pas - just like usual Pascal's unit. Perhaps {$L ... } must be added to that file, though: this way C part will be linked automatically when you are using FooBar unit.
Then your program can call the functions:
program Something; uses FooBar; begin Bar; writeln (Foo (42)) end.
I guess that if I manage to define correctly the 2 previous parts, it will be ok...
Le 29 Jun 2000, à 16:10, Nathalie Jarosz a écrit:
[...]
extern double foo (double x); extern void bar (void);
Where are these functions and in which form? Is it a C program or do I
have
to put it in the pascal unit or program?
[...]
Leçon d'anglais - 1ère partie ;-)
foo = truc bar = bidule et foobar = machinchouette !
En bref, remplace ces trois mots par le nom réel de la fonction, ou de la procédure, que tu veux utiliser (betadev, par exemple) et que tu dois trouver dans un fichier C "truc.h" (peut-être betadev.h...). Tu le trouves ?
Bonne chance
-- Traduction/Translation --
English lesson - Part I ;-)
truc = foo bidule = bar and machinchouette = foobar !
Replace these three words by the real name of the function, or the procedure, that you need (betadev, for example) and that you'll find in a C file called foo.h (betadev.h, perhaps...). Do you find it ?
Good luck
-- Couperin
Pour les francophones (ou "francoscribes") : For those who speak french (or at least read it) : http://www.egroups.com/group/prog_pascal_gnu a french GPC mailing list/un groupe de discussion sur GNU Pascal