[gambit-list] Linkage order will affect behavior of same code?
Marc Feeley
feeley at iro.umontreal.ca
Fri Dec 9 09:08:56 EST 2016
I can’t reproduce your problem and I’m also on OSX El Capitan. Here’s the trace:
% gsc -obj -keep-c main.scm
% gsc -obj -keep-c f1a.scm
% gsc -obj -keep-c f2.scm
% gsc -link f1a.c f2.c main.c
% gsc -obj main_.c
% rm -f main
% gcc -o main f1a.o f2.o main.o main_.o -lgambit
% ./main
Hello from main.scm.
f1a-func was calledHello from f2.scm
Hello from f2.scm
% rm -f main
% gcc -o main main.o f1a.o f2.o main_.o -lgambit
% ./main
Hello from main.scm.
f1a-func was calledHello from f2.scm
Hello from f2.scm
Can you verify your steps? I’m using the latest Gambit from the github repo.
Marc
> On Dec 6, 2016, at 9:27 PM, Meng Zhang <wsxiaoys.lh at gmail.com> wrote:
>
> I have three scm files:
>
> main.scm:
>
> (display "Hello from main.scm.")
> (newline)
> (f1a-func)
> (f2-func)
>
> f1a.scm:
> (define (f1a-func)
> (display "f1a-func was called")
> (f2-func)
> (newline))
>
> f2.scm:
> (define (f2-func)
> (display "Hello from f2.scm")
> (newline))
>
> With gcc f1a.o f2.o main.o main_.o -lgambit, it compiles and generate expected output.
> With gcc main.o f1a.o f2.o main_.o -lgambit, it compiles but will raise an exception on missing f1a-func / f2-func.
>
> Is this expected behavior? Any workaround exist? My testing environment is OSX El Captain
>
> Thanks
> Meng
>
>
> --
> Meng
> _______________________________________________
> Gambit-list mailing list
> Gambit-list at iro.umontreal.ca
> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
More information about the Gambit-list
mailing list