[Closed] Using DotNetObjectWrapper in managed C++ plugin
Hello,
I’m trying to return a DotNetObject from a MAXScript method that I’m writing. The project has /CLI enabled, but I’m stuck trying to return a dotNetObject, as I can only return a Value pointer.
#pragma managed
...
def_visible_primitive(DoSomethingDotNet, "DoSomethingDotNet" );
Value* DoSomethingDotNet_cf(Value** arg_list, int count)
{
check_arg_count(DoSomethingDotNet, 0, count);
auto bitmap = gcnew System::Drawing::Bitmap(512,512);
return bitmap; // How do I convert this Object^ into a Value* -> DotNetObjectWrapper::intern(bitmap);?
}
Looking at the samples, I found the mxsdotNet project, which seems to do exactly what I want. The DotNetObjectWrapper class defines a method:
static Value* intern(System::Object ^ object); // wraps existing System::Object, returns dotNetObject or dotNetControl
However I have no idea how to call this method. I’ve tried including the mxsdotNet project in my solution but I am unable to compile it, I get a linker error after I #include “DotNetObjectWrapper.h”:
[b]error LNK2005: DllMain already defined in MSVCRTD.lib(dllmain.obj)
[/b]There is no other DllMain method in my project and I’ve commented out everything but the #include statement and I still get it. So is there a better way to use mxsdotNet? I just want to have access to my Bitmap i[/i] in MAXScript.
Thanks,
Vincent