Hi,
Suppose I have two NIF libraries, NifA and NifB.
NifA is allocating a resource which is a struct holding some data, say instance of class ClassA and ClassB, like
class A;
class B;
struct S
{
A a;
B b;
};
NifB is another self-sufficient NIF library which can create and operate instances of the same ClassA above.
Now I want to allocate an instance of the resource using NifA (possibly returning a tuple of term representing the resource itself (S) + term representing inner ClassA) and use functions of both NifA and NifB to operate on the same instance of the resource. So NifA will use S, and NifB will use ClassA allocated inside of S.
Is this actually possible? If so, can someone please provide an example?
I can modify both NIFs, so in case I should allocate ClassA from the second Nif its OK. The point is the first NIF operates on ClassA and the second NIF operates on the same instance of ClassA + another ClassB.