On Fri, Nov 08, 2002 at 11:23:54AM +0100, Markus Gerwinski wrote:
Does this example mean, I have to write a pascal _program_ file just to ignore its "main"?! Isn't there a more explicit way to init the RTS?
As long as you do not need any output with 'WriteLn' and such, you can write things like that:
=== foo.pas === unit Foo;
interface
function FooFunc (a: Integer): Integer; asmname '_c_foo_proc';
implementation
function FooFunc (a: Integer): Integer; begin FooFunc := a * a * 2 end;
end.
=== bar.c === #include <stdio.h>
extern int _c_foo_proc (int);
int main (void) { printf ("Now im Calling Foo with 3: %d\n", _c_foo_proc (3)); return 0; }
=== compile === gpc -c foo.pas gcc bar.c foo.o -lgpc -lm
Eike