Do you also have the -framework OpenCL flag? Static libraries don't automatically link in their dynamic dependencies. <br><br>On Tuesday, March 13, 2012, CharlesStain <<a href="mailto:alfredo.dinapoli@gmail.com">alfredo.dinapoli@gmail.com</a>> wrote:<br>
> Hi everyone,<br>> I'm developing an Erlang binding to a C++ library of mine, which relies on<br>> OpenCL.<br>> I set up a basic environment, with proper extern "C", as well as linker<br>> flags. In my case the magic words are:<br>
><br>> -undefined dynamic_lookup -dynamiclib<br>><br>> Without these additional flags my NIF shared library won't compile.<br>> Everything work well until I try to link OpenCL within my NIF library. Bear<br>
> in mind that I'm on Mac OS and OpenCL comes as a dynamic library (a Cocoa<br>> Framework to be more specific) and going to another platform like Linux or<br>> Windows is not feasible.<br>> When I try to load my "new" NIF library (with OpenCL linked with it), this<br>
> is the result:<br>><br>> laetus alfredodinapoli$ rebar eunit<br>> ==> elaetus (eunit)<br>> Compiled src/elaetus_app.erl<br>> Compiled src/elaetus_sup.erl<br>> Compiled src/elaetus.erl<br>> Trace/BPT trap: 5<br>
><br>> Which is not very informative about what's going wrong. But I suspect it may<br>> be related to the dynamic nature of the OpenCL library. In fact, linking my<br>> framework, which is a static library, doesn't cause any issue.<br>
> I would like to know:<br>><br>> a) If anyone has had any contact with the NIF + MacOs + C++ world<br>> b) If anyone know a workaround for this annoying situation.<br>><br>> Thanks in advance,<br>> Alfredo Di Napoli<br>
><br>> --<br>> View this message in context: <a href="http://erlang.2086793.n4.nabble.com/OpenCL-framework-cause-my-NIF-library-to-crash-tp4469412p4469412.html">http://erlang.2086793.n4.nabble.com/OpenCL-framework-cause-my-NIF-library-to-crash-tp4469412p4469412.html</a><br>
> Sent from the Erlang Questions mailing list archive at Nabble.com.<br>> _______________________________________________<br>> erlang-questions mailing list<br>> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
> <a href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a><br>>