How can I create a dll from simple python code that can be called in VBA

I know that this is a very big question, but I will try to make it as simple as possible.

Assuming my example.py contains only the following code:

 def xsum(a,b): return a+b 

How can I encapsulate this in a DLL that would be called without actually having the python end user on the computer. My goal is to use it in VBA.

I looked at py2exe that creates .exe, but I cannot find a solution for the dll. Any help would be greatly appreciated. I am using python 3.6

+5
source share
1 answer

Cython (http: cython.org) creates C code from python sources. This generated one can be compiled in a dll and called from VBA

Read the β€œUsing Cython Ads from C” section of the documentation

 http://www.google.com/search?q="Using+Cython+Declarations+from+C"+site:cython.org 
+2
source

All Articles