• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1614
  • Last Modified:

Embedding a C# dll into a Python script

This question concerns an alternate approach to my currently open question.

I have a C# dll that consists of a number of classes, plus a user form.  I'm embedding the dll into a Python script that starts as follows:

from ctypes import *
y = cdll.LoadLibrary("c:\\Projects\\Front Counter\\fc_main\\FC_Main\\bin\\Debug\\FC_Main.dll")

I'm not sure where to go from here.  Basically, I can't call a method directly (e.g., y.<some method>) because all the methods are contained within classes in the dll.

How can I implement the Python script so that I can access the methods, properties, etc. of the dll?

Thanks in advance...
0
cshore12
Asked:
cshore12
  • 3
3 Solutions
 
jdavistxCommented:
This SO answer seems to have some good information:
http://stackoverflow.com/questions/2077870/how-to-load-a-c-dll-in-python

It would appear as though you either need to use a .net-wrapped Python, such as IronPython, or make some changes to your current C# DLL such that you expose it as a COM object so that you can import it natively in to Python.
0
 
cshore12Author Commented:
Yeah, I've already seen this reference and it's about 3/4 Greek to me.  Perhaps you can expand on it somewhat.
0
 
cshore12Author Commented:
I've been convinced that the GIS application that this refers to is too complex for either of the suggestions you made.  Thanks anyway!
0
 
cshore12Author Commented:
jdavistx provided a link that I was already familiar with, and which was difficult to follow.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now