Dear GPC Users, I have installed gpc on my MacOS 10.2.6 computer. I have the following makefile, which makes executable glue out of main.c and foobar.p. I compile main.c as a library so I can look inside it with otool -v -t -V and see the symbolic stub references. glue: main.o foobar.o gpc main.o foobar.o -o glue main.o: main.c gpc -c main.c -o main.o foobar.o: foobar.p gpc -c foobar.p -o foobar.o rm foobar.p clean: rm foobar.o foobar_unit.gpi main.o glue Foobar.p looks like: unit Foobar_Unit; interface function Foobar(x:longint):longint; implementation function Foobar(x:longint):longint; begin Foobar:=x*x*x; end; end. and main.c looks like: #include <stdio.h> extern int Foobar(int x); int main() { printf("The Foobar of %d is %d \n",5,Foobar(5)); return 0; } I get no compiler warnings, but when I run glue from the terminal command line my output is: The Foobar of 5 is -1985538999 I have been trying for a couple of days, and I cannot get the main.o object to link correctly to foobar.o. I think I need to add some gpc command-line options, but none that I have tried seem to work. Thy symbols in the objects are correct, and I get an unresolved symbol error if I remove foobar.o from the makefile directory. Can you help? Yours, Kevan Hashemi, Brandeis University Physics Department
participants (2)
-
Adriaan van Os -
Kevan Hashemi