1

I have a python file generated by swig (no experience with this). It contains this at the top:

# This file was automatically generated by SWIG (http://www.swig.org).
# Version 2.0.4
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.

and contains class definitions. Is it possible to generate C# classes from this to represent the 'data structure', which has to be hydrated from some proprietary database?

At the end of the day I have to talk to Python from C#. I am currently doing this by writing python files and then invoking Python from C#.

Any feedback would be very much appreciated. Thanks.

cs0815
  • 16,751
  • 45
  • 136
  • 299
  • I have no access to the original C/C++. Not sure about ironpython. My understanding is that it only adds python to .net. Not sure whether it can also be used to invoke 'native' python. – cs0815 Oct 16 '12 at 10:47
  • Thanks. Feel free to compose an answer ... – cs0815 Oct 16 '12 at 11:08

1 Answers1

1

SWIG is for wrapping C or C++ so it can interface with other languages? e.g. you might use swig to wrap some C so you can call it from python or C# - but not to wrap some C# so you can call it from python (or vice-versa).

Potentially ironpython could be useful in this instance?

sounds to me what your doing already is the right solution, i.e. invoking python from C#. SWIG is irrelevant as you don't have any C code to wrap.

some links that may be helpful are:

Community
  • 1
  • 1
bph
  • 10,728
  • 15
  • 60
  • 135