Dear Pavel,

It seems that creating several instances of a *native* functor is not a good idea. I suggest you modify your functor such that the module is unique. The idea is to encapsulate the state in a data structure, and not in the module itself. You can then create your objects G and H as

[M]={Module.link ['object.so{native}']}
G={M.new ...}
H={M.new ...}

G and H can be defined as extensions (see the documentation on how to create extensions to the language at http://www.mozart-oz.org/documentation/apptut/node19.html#part.foreign.extensions).


Cheers,
raph

Pavel wrote:
On Thu, 28 Jun 2007 12:10:01 +0200, Raphael Collet <[EMAIL PROTECTED]> wrote:

Pavel wrote:
Hi,
I am wondering if it's possible to import a shared object into a program twice.
Basically, what I want to do is:
[G] = {Module.link ['object.so{native}']}
[H] = {Module.link ['object.so{native}']}
with G and H becoming separate objects with separate internal states.
Is there some simple solution for that?

Yes, use Module.apply instead of Module.link. The documentation of Module explains this very well.

Thanks for your reply, but I am afraid I need some more assistance with the issue.
When I simply change link to apply I get this error:

_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to