Friday, November 13, 2009

.NET remoting via COM and Python

I bumped into a problem when trying to talk to C# DLLS that are created by my team while i am using Python. Creating a COM C# DLL is the key to bridge the communication since creating COM  interface via C# is the easiest thing to do compared to C++.

Now one of the C# DLLs is loaded as a singleton in Windows Service thus i need my C# COM to talk to the same class via remoting.

That is when i kept on encountering “return argument has invalid type”  whenever the remoting part was done. Putting "[Serializable]” into the class declarating did not help.

It ran perfectly when the class in the C# dll is used as a local class but it balked whenever the same class was returned via remoting and to me that is just ONE line of change.

// MyClass myClass = new ManagerClass()  <--- local class

// RemotingReturnMyClass(out myClass) <—remoting

I went on to combining the COM class code and the C# singleton DLL in the attempt to create a singleton COM so that the C# singleton class can be accessed via my python code to no avail.

After DAYS (yup days) of trying to solve it, i suddenly realize something that i missed. What if i put the C# DLL into c:\python25 since maybe the problem is all about the marshaller and proxy not being able to locate it…….

Bingo.

No comments:

Post a Comment