Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #28812 > unrolled thread

Compile python code into a dll

Started byRolf Wester <rolf.wester@ilt.fraunhofer.de>
First post2012-09-10 14:15 +0200
Last post2012-09-11 09:05 +0200
Articles 5 — 4 participants

Back to article view | Back to comp.lang.python


Contents

  Compile python code into a dll Rolf Wester <rolf.wester@ilt.fraunhofer.de> - 2012-09-10 14:15 +0200
    Re: Compile python code into a dll Ramchandra Apte <maniandram01@gmail.com> - 2012-09-10 06:08 -0700
    Re: Compile python code into a dll Miki Tebeka <miki.tebeka@gmail.com> - 2012-09-10 06:11 -0700
    Re: Compile python code into a dll Terry Reedy <tjreedy@udel.edu> - 2012-09-10 12:06 -0400
    Re: Compile python code into a dll Rolf Wester <rolf.wester@ilt.fraunhofer.de> - 2012-09-11 09:05 +0200

#28812 — Compile python code into a dll

FromRolf Wester <rolf.wester@ilt.fraunhofer.de>
Date2012-09-10 14:15 +0200
SubjectCompile python code into a dll
Message-ID<504dd9c6$1@news.fhg.de>
Hi,

I have Python code that I would like to compile into a dll (I have to 
deliver a C/C++ callable dll and I don't want to reimpelement the Python 
code in C/C++). It's not for extending Python but I want to call the 
Python functions and classes from C/C++. It's more like extending C/C++ 
with Python. I would be very appreciative for any help.

Thank you in advance

Regards
Rolf

[toc] | [next] | [standalone]


#28813

FromRamchandra Apte <maniandram01@gmail.com>
Date2012-09-10 06:08 -0700
Message-ID<26783863-134f-4d58-a56f-a0a14ee0e15d@googlegroups.com>
In reply to#28812
On Monday, 10 September 2012 17:45:11 UTC+5:30, Rolf Wester  wrote:
> Hi,
> 
> 
> 
> I have Python code that I would like to compile into a dll (I have to 
> 
> deliver a C/C++ callable dll and I don't want to reimpelement the Python 
> 
> code in C/C++). It's not for extending Python but I want to call the 
> 
> Python functions and classes from C/C++. It's more like extending C/C++ 
> 
> with Python. I would be very appreciative for any help.
> 
> 
> 
> Thank you in advance
> 
> 
> 
> Regards
> 
> Rolf

http://docs.python.org/extending/embedding.html is the official docs for this thing
Embedding is similar to extending.

[toc] | [prev] | [next] | [standalone]


#28814

FromMiki Tebeka <miki.tebeka@gmail.com>
Date2012-09-10 06:11 -0700
Message-ID<f90da2fd-6d69-4953-a16b-981951a05399@googlegroups.com>
In reply to#28812
> I have Python code that I would like to compile into a dll (I have to 
See http://docs.python.org/extending/embedding.html. You can pack your code in a zip file and load it from the DLL entry point (something like what py2exe does).

See also the Freeze tool - http://wiki.python.org/moin/Freeze.

HTH,
--
Miki (http://pythonwise.blogspot.com/)

[toc] | [prev] | [next] | [standalone]


#28829

FromTerry Reedy <tjreedy@udel.edu>
Date2012-09-10 12:06 -0400
Message-ID<mailman.449.1347293236.27098.python-list@python.org>
In reply to#28812
On 9/10/2012 8:15 AM, Rolf Wester wrote:

> I have Python code that I would like to compile into a dll (I have to
> deliver a C/C++ callable dll and I don't want to reimpelement the Python
> code in C/C++). It's not for extending Python but I want to call the
> Python functions and classes from C/C++. It's more like extending C/C++
> with Python. I would be very appreciative for any help.

Cython compiles CPython to C which can be compiled by and c/c++ 
compiler. I believe it can do the above. "This makes Cython the ideal 
language for wrapping external C libraries, embedding CPython into 
existing applications, ". I think the latter is what you want to do.

http:cython.org

-- 
Terry Jan Reedy

[toc] | [prev] | [next] | [standalone]


#28876

FromRolf Wester <rolf.wester@ilt.fraunhofer.de>
Date2012-09-11 09:05 +0200
Message-ID<504ee29a$1@news.fhg.de>
In reply to#28812
Thank you all for your help. I'm going to try Cython.

Regards
Rolf


On 10/09/12 14:15, Rolf Wester wrote:
> Hi,
>
> I have Python code that I would like to compile into a dll (I have to
> deliver a C/C++ callable dll and I don't want to reimpelement the Python
> code in C/C++). It's not for extending Python but I want to call the
> Python functions and classes from C/C++. It's more like extending C/C++
> with Python. I would be very appreciative for any help.
>
> Thank you in advance
>
> Regards
> Rolf

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web