Argh, sorry to spam. It seems Carbon is a red herring. poly/CInterface seems to crash when the code is linking *any* framework via the "-framework XXX" option to gcc.
On 2 July 2012 17:25, Aleks Kissinger aleks0@gmail.com wrote:
Okay, I've gotten poly to crash for a simpler example (as reproducing my exact gtk build would a pain...). It seems that the process receives a SIGKILL whenever it tries to load code linking Carbon, which GTK-OSX has the misfortune of doing. Here's how to reproduce the bug on OS X:
/* diff.c */ int difference (int x, int y) { ? ? return x > y ? x - y : y - x; }
# test.ML open CInterface; val lib = load_lib "libdiff.so"; val diff = call2 (load_sym lib "difference") (INT,INT) INT; val d = diff (2,3);
Now, running these commands works as expected: $ gcc -c diff.c $ gcc -shared diff.o -o libdiff.so $ poly --use test.ML
But these cause poly to receive a SIGKILL: $ gcc -c diff.c $ gcc -framework Carbon -shared diff.o -o libdiff.so $ poly --use test.ML ... val lib = ?: dylib val diff = fn: int * int -> int [1] ? ?64760 killed ? ? poly --use test.ML
Any ideas? Since Carbon is deprecated, I suspect it is coming in to conflict with something used by poly, but I haven't been able to track it down.
On 24 June 2012 01:47, Aleks Kissinger aleks0@gmail.com wrote:
Any idea why calling symbols from certain shared libraries would cause poly/ML to crash on OS X? Example:
val gtk = load_lib "libgtk-quartz-2.0.dylib";
val gtk = ?: dylib
val gtk_init = call2 (load_sym gtk "gtk_init") (INT,INT) VOID;
val gtk_init = fn: int * int -> unit
gtk_init(0,0);
[1] ? ?96630 killed ? ? rlwrap -z ?poly
This (or rather, the equivalent) code works fine on linux, and "libgtk-quartz-2.0.dylib" will link with C code in OS X with no problems. It seems to only do this for some libraries. For instance, the "difference" example from the poly docs (http://www.polyml.org/docs/CInterface.html) also works fine on OS X.