vanam srihari kumar wrote:
I am porting the code developed by using sun pc and cc compilers to gpc and gcc.the following error is generated while linking.Please see below the dump.
linking /home/kvsspl/exe/solaris/esigraph ld: Software Generation Utilities - Solaris Link Editors: 5.8-1.285 Undefined first referenced symbol in file __PC0__PCEXIT esigraph.o __PC0__PCSTART esigraph.o ld: fatal: Symbol referencing errors.
If C main program calls a Pascal procedure that does I/O, then the following code should be included in the C main program before calling the Pascal procedure:
#if defined(SOLARIS) __PC0__PCSTART(argc, argv); #endif #if defined(SOLARIS) __PC0__PCEXIT(argc, argv); #endif
Please suggest me as how to get rid of this error
Is this a requirement by your project (then, where does it define __PC0__PCEXIT and __PC0__PCEXIT -- you may need to declare the linker name there), or by the Sun compiler? In the latter case, it doesn't apply to GPC.
However, GPC has different requirements when calling Pascal code from a C main program. Please see gpc-in-c.h that comes with GPC -- at least with recent versions. In gpc-2.1, I don't think this file was there. AFAIR, you have to declare and call those functions from C:
Always:
extern void _p_initialize (int argc, char **argv, char **envp);
(you may pass NULL for envp)
If you have a Pascal `program':
extern void init_pascal_main_program (void);
If you have a Pascal module called `Foo':
extern void init_Foo (void);
At the end:
extern void _p_finalize (void);
Frank