Nic Webb wrote:
Yeah, I've got a few test cases I'm trying to get to work with that... I've got a unit1.pas which just has a procedure called printhi in it (just prints something to stdout).
so, I compile the unit with gpc
gpc -c unit1.pas
and get the object file. Now I build a header file for it defining printhi as an external subroutine: extern void printhi(); then compile the c source that uses printhi in it's main block, linking in the object file I created before like so:
gcc -i unit1.o useunit.c
This is where things go ary. I get errors saying that the following symbols are undefined: stdout write check_inoutres collect_flag collect inoutres
are these in some unit that I need to include? should I include gpc.o in my gcc command line like I did unit1.o?
You need to link -lgpc and -lm if you do the linking with gcc -- but you can just as well do it with gpc, then this happens automatically.
You also need to call some initializers. Please see the (working!) examples I mentioned, and the comments in gpc-in-c.h
Frank