When my functions are in the global namespace, I am able to registerOLEInterface(global_fn1,global_fn2) and then python or c# max object invokes method “global_fn1” of the COM object or its wrapper.
I moved all my code into structs and they are no longer available.
RegisterOLEInterface(structInst1.otherStructInst2.priv_fn1, structInst1.otherStructInst2.priv_fn2) and invoke method “priv_fn1” doesn’t work, nor does invoke method “structInst1.otherStructInst2.priv_fn2”.
Nor does invoke method “otherStructDef2.priv_fn2”.
Do I need to use handles, or is there undocumented name mangling? Which function name do I hand off and invoke?
Because I like the pretty struct namespaces, but I’m back to the workaround of wrapping the pretty functions with a global namespace name.
Ungh, when I get time later, I’m cribbing some steps from Lucian's VBlog | Microsoft Learn to look at the names of the functions in the ole object members. Let you all know what that looks like.
The gist is, you can add your own reflection to COM if you can get typeinfo from the implemented IDispatch interface. But the references says this is explicitly disabled.
It supports only the IDispatch form of interface with no accessible type information – clients need to declare their reference to the 3ds Max server object as an untyped generic object.
This matches my mucking about with c# code: adding the IDispatch interface described and trying to cast to it comes up null. Of course, COM is kind of deep, so I’m still light on the topic.
Out of time on this. Going back to registering global functions with explicit names and adding them to registerOLEInterface, since I can’t guess what name mangling (if any!) they are available under, and the old way used to work.
Maybe Autodesk can provide an interop assembly next go-round, or add inspection/reflection details? Does anyone running 2010 know if it is better about this?