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?
-Nic
On Wed, 15 Nov 2000, Peter Gerwinski wrote:
Nic Webb wrote:
The new problem is that I can't figure out how to compile a .pas file with gpc so that it doesn't require a main method (begin end.)... gpc -c file.pas will give me a happy object file that's easily imported into c, but when file.pas has a main method, it conflicts with the one in my main c program...
If you write a unit instead of a program, it will not have a `main' function.
When compiling a unit, please supply the `-c' option, so GPC will just produce an `.o' file and will not try to link.
Hope this helps,
Peter
-- http://home.pages.de/~Peter.Gerwinski/ - G-N-U GmbH: http://www.g-n-u.de Maintainer GNU Pascal - http://home.pages.de/~GNU-Pascal/ - gpc-20001115 GnuPG key fingerprint: 9E7C 0FC4 8A62 5536 1730 A932 9834 65DB 2143 9422 keys: http://www.gerwinski.de/pubkeys/ - AntiSpam: http://spam.abuse.net