[fpc-devel]LINKING a pp library from a MAIN.C produces ERROR when calling WRITELN? (Moderator note: downsized...)

Michael.VanCanneyt at Wisa.be Michael.VanCanneyt at Wisa.be
Wed May 23 01:18:48 CEST 2001

On Tue, 22 May 2001, Javier Ros Ganuza wrote:

> I'm trying to make available a pascal library to the C
> people.
> So my first step was to build a minimal example.
> I've defined and exported a procedure in a library pascal file
> and I've made a main_c.c and a main_pascal.pp files that uses
> such procedure from such library.
> Using gdb I follow the flux of execution, and calling seems to
> be correct in both cases (main_c or main_pascal).
> But  in the C case, when
> (from inside the pascal library) the funtion writeln is
> called the aplication exits with error code 0147.
> If the debuger is not used, the shell do not report any error
> at all, although the aplication exits abnormally.
> I supouse the problem is that the C executable should be
> linked to some other libraries, or perhaps it is related to the
> pascal initialization of the io system or something related to
> standard io streams.

The problem is that the system unit (nor any other unit)  is not
initialized on Linux or DOS; you should manually initialize all units.

The best you can do is call FPC_INITIALIZEUNITS, and this will initialize
all units for you.

We are working to solve this problem.


More information about the fpc-devel mailing list