[erlang-questions] OpenCL.framework cause my NIF library to crash

CharlesStain alfredo.dinapoli@REDACTED
Tue Mar 13 16:49:17 CET 2012


Hi everyone,
I'm developing an Erlang binding to a C++ library of mine, which relies on
OpenCL.
I set up a basic environment, with proper extern "C", as well as linker
flags. In my case the magic words are:

-undefined dynamic_lookup -dynamiclib

Without these additional flags my NIF shared library won't compile.
Everything work well until I try to link OpenCL within my NIF library. Bear
in mind that I'm on Mac OS and OpenCL comes as a dynamic library (a Cocoa
Framework to be more specific) and going to another platform like Linux or
Windows is not feasible.
When I try to load my "new" NIF library (with OpenCL linked with it), this
is the result:

laetus alfredodinapoli$ rebar eunit
==> elaetus (eunit)
Compiled src/elaetus_app.erl
Compiled src/elaetus_sup.erl
Compiled src/elaetus.erl
Trace/BPT trap: 5

Which is not very informative about what's going wrong. But I suspect it may
be related to the dynamic nature of the OpenCL library. In fact, linking my
framework, which is a static library, doesn't cause any issue.
I would like to know:

a) If anyone has had any contact with the NIF + MacOs + C++ world
b) If anyone know a workaround for this annoying situation.

Thanks in advance,
Alfredo Di Napoli

--
View this message in context: http://erlang.2086793.n4.nabble.com/OpenCL-framework-cause-my-NIF-library-to-crash-tp4469412p4469412.html
Sent from the Erlang Questions mailing list archive at Nabble.com.



More information about the erlang-questions mailing list