|
From: | Raffael Cavallaro |
Subject: | Re: [Chicken-users] foreign-lambda* problems on Mac OS X |
Date: | Tue, 12 Jul 2005 11:04:02 -0400 |
On Jul 12, 2005, at Tue, Jul 12, 10:04 37 AM, felix winkelmann wrote:
In the code in question, tak is the scheme name of a foreign-lambda* that calls itself recursively - that is, the takeuchi function call benchmark. I think that this is a recursion issue, since the basic my-strlen example that Thomas Chust was kind enough to send works fine. -------- begin tak-fp-c.scm ------- #>! float tak(float, float, float); <# (define tak (foreign-lambda* float ((float x) (float y) (float z)) "if (y >= x) { return (z); } else { return (tak(tak(x-1,y,z), tak(y-1,z,x), tak(z-1,x,y))); }")) -------- end tak-fp-c.scm --------- Is it not possible to embed a recursive C function using foreign-lambda* or foreign-safe-lambda*? I've tried both, and both give the same error: rafg5:/scheme raffaelc$ sudo chicken-setup tak-fp-c.scm Password: /usr/local/bin/csc -feature compiling-extension -O2 -d0 -vs tak-fp-c.scm /usr/local/bin/chicken tak-fp-c.scm -output-file tak-fp-c.c -dynamic -feature chicken-compile-shared -quiet -feature compiling-extension -optimize-level 2 -debug-level 0 gcc tak-fp-c.c -o tak-fp-c.o -DHAVE_CHICKEN_CONFIG_H -Os -fomit-frame-pointer -fno-strict-aliasing -Wall -Wno-unused -Wno-uninitialized -DHAVE_ALLOCA_H -no-cpp-precomp -DC_STACK_GROWS_DOWNWARD=1 "-DC_INSTALL_LIB_HOME=\"/usr/local/lib/chicken\"" "-DC_INSTALL_HOME=\"/usr/local/share/chicken\"" -DC_USE_C_DEFAULTS -fPIC -DPIC -DC_SHARED -c -DC_NO_PIC_NO_DLL rm tak-fp-c.c gcc -o tak-fp-c.so tak-fp-c.o -lchicken -fPIC -bundle -L/usr/local/lib -ldl -lm -ldl /usr/bin/ld: Undefined symbols: _tak collect2: ld returned 1 exit status *** Shell command terminated with exit status 1: gcc -o tak-fp-c.so tak-fp-c.o -lchicken -fPIC -bundle -L/usr/local/lib -ldl -lm -ldl Error: shell invocation failed with non-zero return status "/usr/local/bin/csc -feature compiling-extension -O2 -d0 -vs tak-fp-c.scm" 1 Must I define any recursive C functions in an external C file, and then use foreign-lambda instead? Thanks for your help, regards, Ralph Raffael Cavallaro, Ph.D. |
[Prev in Thread] | Current Thread | [Next in Thread] |