Hello,
Thankyou for the response. whe i link the library file, it gives me the following errors.
$ gpc -L/usr/local/psql/lib -lbtrvif -DBTI_DEC_UNIX sqlnew2.pas reqsamp1.o: In function `__btrid': reqsamp1.o(.text+0x5e): undefined reference to `Handler' collect2: ld returned 1 exit status $
But a C program compiled like this works well. Can you tell me what the reason could be?
Thanks and Regards, Anuradha
eike.lange@uni-essen.de wrote:
Hi!
On Mon, Nov 27, 2000 at 04:40:06PM +0530, Anuradha wrote:
My problem is like this : I have the C procedure in a .so file. I have the prototype declaration in a header file. How should the declaration of the procedure be given in my pas file?What will be the types of the parameters(C or pascal)?
Maybe you want to write a wrapper arround your C-Function:
mycfunctions.c:
#include <whatever you need> int _p_myfunction(int x) { calls the routine, you want to use ... return (y); }
In your Pascal-Unit myfunctions.pas:
... Interface
Function myfunction(x : Integer) : Integer; asmname '_p_myfunction';
... Implementation
{$L mycfunctions.c} {$L a library, where the routine used in _p_myfunction resides}
Then write your Pascal-Program, using this unit: myprogram.pas:
Program myprogram; Uses myfunction; ... Begin z := myfunction(33); End.
And then call gpc --automake myprogram.pas -L/path-to/Libs/ -I/path-to/Includes/ -lused_libs
If you need some more examples (and a source), feel free to contact me.
Eike
-- S.Anuradha Generic Data Tools, Alcatel Chennai. Alcanet : 2-757-7123
Anuradha wrote:
Thankyou for the response. whe i link the library file, it gives me the following errors.
$ gpc -L/usr/local/psql/lib -lbtrvif -DBTI_DEC_UNIX sqlnew2.pas reqsamp1.o: In function `__btrid': reqsamp1.o(.text+0x5e): undefined reference to `Handler' collect2: ld returned 1 exit status $
But a C program compiled like this works well. Can you tell me what the reason could be?
- Put the `-lbtrvif' *after* the source file on the command line.
- How is the C function called? If it's `handler' (with a lower-case `h'), be sure to declare it as `asmname 'handler'' in Pascal. Otherwise, please post the declarations (C and Pascal)...
Frank