Click here to Skip to main content
15,068,645 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm using Python 2.5 so I have limited .net support. Despite this I need to call a c#.net class library from a Python module, so

I created a c++/CLI mixed dll with the appropriate extern c functions to create a python extension dll, all great so far. (although I did have to rename from .dll to .pyd)

I then call my c#.net class library from the c++/CLI mixed dll and here is the problem:

I can only get it to work by loading the c#.net class library using Assembley::LoadFrom and calling methods using reflection.

Or to put it another way, if I reference my c#.net class library from the c++/CLI mixed dll then when I consume it in Python it fails to load the c#.net library despite me copying it to \Python25 and \Python25\dlls.

If anybody can shed some light on why when in the python environment can't find my class library and how I can help it to find it, that would be a great help.
Posted
Updated 20-Sep-15 23:07pm
v2
Comments
ARopo 5-Oct-15 6:32am
   
I never did get to the bottom of this, ended up loading the class library dynamically and using reflection to call it. I think in may be something to do with dll initialization and the timing and order of things.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900