[Python.NET] How to use Dll-methods with [out]-arguments and no constructor for the argument-class
Pär Sundbäck
par at sundback.com
Sat Aug 25 20:35:38 CEST 2007
Hi
I am using Python .Net together with PythonWin 2.5.
My task is to use a .Net assembly dll from a python testscript.
The dll is written i C# to create interfaces by refering them as [out]arguments. I am supposed to be sending a reference to a datatype/interface and then get a handle to that created interface for further processing.
The original C# method in the dll looks something like:
HResult=CreateInstance([out] ICHardware hw)
In python I receive this (ofcourse) when using the class (not instance) of the datatype as argument:
>>> hw=ICHardware
>>> ICProductFactory.CreateInstance(hw)
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
TypeError: No method matches given arguments
My problem is that I can not create an instance of ICHardware from Python since the constructor is hidden in the dll (or not in there at all).
In C# I would do like this when using the dll:
ICHardware hw;
ICProductFactory.CreateInstance(hw);
hw.Method....
In Python this is not possible since I can not declare a variable without assign a value or running the constructor, or? Maybe someone knows a work-around for this. I'll be happy for all feedback.
Regards /Pär
--
Jag använder gratisversionen av SPAMfighter för privata användare.
4941 spam har blivit blockerade hittills.
Betalande användare har inte detta meddelande i sin e-post.
Hämta gratis SPAMfighter här: http://www.spamfighter.com/lsv
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythondotnet/attachments/20070825/e448b50c/attachment.htm
More information about the PythonDotNet
mailing list