Skip to content Skip to sidebar Skip to footer

Using Cython To Expose Functionality To Another Application

I have this C++ code that shows how to extend a software by compiling it to a DLL and putting it in the application folder: #include #include

Solution 1:

I think the solution is to use both. Let me explain.

Cython makes it convenient to make a fast plugin using python but inconvenient (if at all possible) to make the right "kind" of DLL. You would probably have to use the standalone mode so that the necessary python runtime is included and then mess with the generated c code so an appropriate DLL gets compiled.

Conversely, elmer makes it convenient to make the DLL but runs "pure" python code which might not be fast enough. I assume speed is an issue because you are considering cython as opposed to simple embedding.

My suggestion is this: the pure python code that elmer executes should import a standard cython python extension and execute code from it. This way you don't have to hack anything ugly and you have the best of both worlds.


One more solution to consider is using shedskin, because that way you can get c++ code from your python code that is independent from the python runtime.

Post a Comment for "Using Cython To Expose Functionality To Another Application"