[erlang-questions] Sharing resource types between NIFs

Loïc Hoguin essen@REDACTED
Sat Feb 15 23:22:37 CET 2014


Hello,

I have been looking into this and after looking into the source it 
doesn't seem possible, but I might as well ask just in case.

Say I am writing bindings for a big library. That library is cut into 
various components, and I would like to do similar on the Erlang side. 
Components are more or less dependent. Let's just say that component B 
uses component A. You can't do anything in B without A. They are both 
NIF resources pointing to things used by the library.

Now if I try to create a NIF module for A and a NIF module for B, I need 
to access the resource type of A from the B NIF. I tried simply 
exporting a function from the A .so and use it from the B .so, the 
function returns the resource type as expected, however using it to 
retrieve the resource fails.

Trying to do the same from A of course works. It's just trying to use 
the resource type of A from B that fails.

I'm assuming this isn't possible?

Thanks.

-- 
Loïc Hoguin
http://ninenines.eu



More information about the erlang-questions mailing list