On Mon, May 12, 2008 at 9:50 PM, Gordon Henriksen <gordonhenriksen at mac.com> wrote:> On May 12, 2008, at 12:00, Mahadevan R wrote: > > > 1) The MP dtor does a no-op (deletes self, but not the module it owns) > > That's not how the object works...Yes, I know ;-) I was hoping you could add a detach() or some such API for the MP...
> > That's not how the object works...Gordon, I think I can make it work if we have the following additional function in LLVM-C: LLVMModuleRef LLVMGetModule(LLVMModuleProviderRef MP) { return wrap(unwrap(MP)->getModule()); } Do you think you could add that? Can I send you a patch? Thanks & Regards, -Mahadevan.
On 2008-05-13, at 02:12, Mahadevan R wrote:>>> That's not how the object works... > > Gordon, I think I can make it work if we have the following additional > function in LLVM-C: > > LLVMModuleRef LLVMGetModule(LLVMModuleProviderRef MP) { > return wrap(unwrap(MP)->getModule()); > }Can I ask, how general is your solution? I only intended to use this particular example as a proxy for the general problem of interaction between GC and manual memory management being complex. Will you require changing your Module bindings if another kind of object can take ownership of a Module?> Do you think you could add that? Can I send you a patch?Certainly. — Gordon