473,911 Members | 5,861 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Embedding python in C

Hi,

Is there a program out there that would generate the C code to instantiate
objects and call them:

ex: miracle.exe -i mymodule.py -o module_internfa ce.c ?

I seem to recall a _yes_ to that but I got a memory overflow :-)

Thanks,

Philippe
Jul 19 '05 #1
4 1327
Just to make sure i'm clear as I've been told about swig and pyrex: I don't
want to eventually have a python script call C modules, but rather a main.c
make calls to python functionnalitie s.

I did add newbie in the title :-)

Regards,

Philippe

Philippe C. Martin wrote:
Hi,

Is there a program out there that would generate the C code to instantiate
objects and call them:

ex: miracle.exe -i mymodule.py -o module_internfa ce.c ?

I seem to recall a _yes_ to that but I got a memory overflow :-)

Thanks,

Philippe


Jul 19 '05 #2
Sorry, it is still not clear when I reread it:

1) I have a bunch of Python working modules
2) I need to compile "something" so external C applications can access 1)

Thanks,

Philippe

Philippe C. Martin wrote:
Just to make sure i'm clear as I've been told about swig and pyrex: I
don't want to eventually have a python script call C modules, but rather a
main.c make calls to python functionnalitie s.

I did add newbie in the title :-)

Regards,

Philippe

Philippe C. Martin wrote:
Hi,

Is there a program out there that would generate the C code to
instantiate objects and call them:

ex: miracle.exe -i mymodule.py -o module_internfa ce.c ?

I seem to recall a _yes_ to that but I got a memory overflow :-)

Thanks,

Philippe


Jul 19 '05 #3
pyrex can be used for embedding too.
http://www.freenet.org.nz/python/embeddingpyrex/

On 6/28/05, Philippe C. Martin <ph************ *@sbcglobal.net > wrote:
Actually maybe not ... looking at the doc:

I have modules already coded in Python, and I need a C wrapper so C
applications may link with it.

Regards,

Philippe



On Tuesday 28 June 2005 04:53 pm, Philippe C. Martin wrote:
Sounds like it, thanks.

Philippe

On Tuesday 28 June 2005 09:10 pm, Chris Lambacher wrote:
Pyrex might be what you are looking for:
http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/

-Chris

On 6/28/05, Philippe C. Martin <ph******@phili ppecmartin.com> wrote:
> Hi,
>
> Is there a program out there that would generate the C code to
> instantiate objects and call them:
>
> ex: miracle.exe -i mymodule.py -o module_internfa ce.c ?
>
> I seem to recall a _yes_ to that but I got a memory overflow :-)
>
> Thanks,
>
> Philippe
> --
> http://mail.python.org/mailman/listinfo/python-list


--
*************** *************** *******
Philippe C. Martin
SnakeCard, LLC
www.snakecard.com
+1 405 694 8098
*************** *************** *******

--
Christopher Lambacher
la******@comput er.org
Jul 19 '05 #4
Thanks, I cannot get the demo to compile, but I joined their list.

Thanks

Philippe

Chris Lambacher wrote:
pyrex can be used for embedding too.
http://www.freenet.org.nz/python/embeddingpyrex/

On 6/28/05, Philippe C. Martin <ph************ *@sbcglobal.net > wrote:
Actually maybe not ... looking at the doc:

I have modules already coded in Python, and I need a C wrapper so C
applications may link with it.

Regards,

Philippe

On Tuesday 28 June 2005 04:53 pm, Philippe C. Martin wrote:
> Sounds like it, thanks.
>
> Philippe
>
> On Tuesday 28 June 2005 09:10 pm, Chris Lambacher wrote:
> > Pyrex might be what you are looking for:
> > http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/
> >
> > -Chris
> >
> > On 6/28/05, Philippe C. Martin <ph******@phili ppecmartin.com> wrote:
> > > Hi,
> > >
> > > Is there a program out there that would generate the C code to
> > > instantiate objects and call them:
> > >
> > > ex: miracle.exe -i mymodule.py -o module_internfa ce.c ?
> > >
> > > I seem to recall a _yes_ to that but I got a memory overflow :-)
> > >
> > > Thanks,
> > >
> > > Philippe
> > > --
> > > http://mail.python.org/mailman/listinfo/python-list


--
*************** *************** *******
Philippe C. Martin
SnakeCard, LLC
www.snakecard.com
+1 405 694 8098
*************** *************** *******



Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2521
by: jordi | last post by:
Hi, I'm starting to use Python embedded in a C program. I'm using Python to execute several scripts using as a variables information retrieved for several multithread "agents" written in C. The method is: 1- Create a thread for each agent (I use a pool thread, every agent run in a different thread) 2- Precompile a different script for each agent. 3- Make the agent retrieve its data
0
1863
by: Atul Kshirsagar | last post by:
I am embedding python in my C++ application. I am using Python *2.3.2* with a C++ extention DLL in multi-threaded environment. I am using SWIG-1.3.19 to generate C++ to Python interface. Now to explain it in details, 1. Python initialization and finalization is done in the *main* thread. 2. For each new thread I create a separate sub-interpreter . 3. Using PyRun_String("import myModule"...) before execution of python
23
3000
by: Robey Holderith | last post by:
Anyone know a good way to embed python within python? Now before you tell me that's silly, let me explain what I'd like to do. I'd like to allow user-defined scriptable objects. I'd like to give them access to modify pieces of my classes. I'd like to disallow access to pretty much the rest of the modules.
4
2799
by: Alicia Haumann | last post by:
I accidentally sent this to webmaster@python.org, so this could be a duplicate if "webmaster" forwards it to this list. :{ Hi, there. Thanks for any help that can be offered. I've been working with Python for a year or more now, but only doing simple extending in C/C++. I'm now attempting some embedding and several questions have come to mind. BTW - I'm running Windows 2000 with Python23 and VisualC++ developers
1
537
by: Martin | last post by:
Greetings, I am new to python and wish to embed python in an 3D graphics application to provide application automation. The high level goal is to be able to drive my app from a script for batch job like behavior rather than via the GUI (ie. I would like to run a script and see those changes reflected in the GUI as if the user had clicked buttons, etc.) The application is written in C++ and uses QT for the GUI. I have read the python...
2
2885
by: Roose | last post by:
With some googling I have found these resources: http://docs.python.org/ext/win-dlls.html http://www.python.org/doc/faq/windows.html I have a large Win32/MFC/C/C++ application that has an embedded scripting language (a very limited one). I would like to rip it out and replace it with Python. I am thinking that this would be relatively simple since the scripting language is a very small interface between the UI and the engine --...
1
1932
by: amit | last post by:
Hello, I am currently studying how to embedd python. I am developing a graphical C++ application. My goal is to embedd python script that will control some kind of animation. I have some questions about python embedding: 1) Is there a good text book or other resource on embedding/extending? (I find it hard to learn only by the tutorial and C/Python API from the python.org site)
1
1842
by: Tommy Nordgren | last post by:
I want to write an application that embeds and extends (at least) the Python and Perl interpreters. Now i want to find as much as possible about the Python tools used for extending and embedding Python. To be more specific: My app should: 1. Parse an input file. 2. Call a script in some scripting language, to generate an output file, for example in C++. For task 2 I need to call an embedded interpreter, and also provide call backs from...
6
3017
by: Qun Cao | last post by:
Hi Everyone, I am a beginner on cross language development. My problem at hand is to build a python interface for a C++ application built on top of a 3D game engine. The purpose of this python interface is providing a convenient scripting toolkit for the application. One example is that a user can write a python script like: player = Player() game.loadPlayer(player) player.moveTo(location)
0
2124
by: Tim Spens | last post by:
--- On Fri, 6/27/08, Tim Spens <t_spens@yahoo.comwrote: I think I know where the problem is but I'm unsure how to fix it. When I call Register_Handler(...) from python via callback.setHandler1(callback1) this only seems to affect pythons ability to trigger an "event" in c. PyObject *Handler is always NULL even after I call Register_Handler(...). I thought there was some magic here that was assigning the pointer *Handler to my python...
0
9879
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11349
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10921
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10541
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9728
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8099
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6142
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4776
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3360
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.