473,406 Members | 2,220 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Extending python.


Cheers.

More questions.
Let's say I'm trying to extend python with a c module. That module cannot
be dynamically loaded (for reasons outside my control). I have to create a
custom python executable (or more likely custom python library).
How would I do that? Is there documentation on that somewhere? Most of
what I've seen was for dynamic loading.

2nd Step:
Let's say I'm doing it under windows, using Visual Studio. Is there
anything I have to be aware of?

3rd Step:
Let's say I don't have the source available. I do have the object files,
the resulting libraries and the header files though.

Greg

"The optimist proclaims that we live in the best of all possible worlds,
and the pessimist fears this is true."
- James Branch Cabell
Jul 18 '05 #1
1 1073
xzm
I think you may create custom python exe... something like the
following and just link against your module and python2x.lib. Of
course, you still need to do the usual stuffs of wrapping around you
own C code. Then you may just 'import xyz' in Python:

#include "Python.h"
#include "xyzmodule.h"

int main(int argc, char **argv)
{
PyImport_AppendInittab("xyz", initxyz);
return Py_Main(argc, argv);
}

Grzegorz Dostatni <gr******@ee.ualberta.ca> wrote in message news:<Pi*************************************@e5-05.ee.ualberta.ca>...
Cheers.

More questions.
Let's say I'm trying to extend python with a c module. That module cannot
be dynamically loaded (for reasons outside my control). I have to create a
custom python executable (or more likely custom python library).
How would I do that? Is there documentation on that somewhere? Most of
what I've seen was for dynamic loading.

2nd Step:
Let's say I'm doing it under windows, using Visual Studio. Is there
anything I have to be aware of?

3rd Step:
Let's say I don't have the source available. I do have the object files,
the resulting libraries and the header files though.

Greg

"The optimist proclaims that we live in the best of all possible worlds,
and the pessimist fears this is true."
- James Branch Cabell

Jul 18 '05 #2

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

Similar topics

4
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...
3
by: stefan | last post by:
Hi Folks, I currenty extended some of my C++ functionality to python and also embedded python to use python functionality in my C++ system (and use as well these extended functions). While...
1
by: Richard Townsend | last post by:
In the "Extending and Embedding" part of the Python documentation: section 5.4 "Extending Embedded Python" - it describes how to use a Python extension module from Python that is embedded in a C...
3
by: Marco Meoni | last post by:
Hi all! I've a problem with a C++ class that has to be included in a python application. One way to do it is Extending and Embedding the Python Interpreter Now i have 2 questions 1) Is there a...
5
by: vbgunz | last post by:
Hello everyone. I own two books. Learning Python and Python in a nutshell. When cross referencing the two books to try and clarify the ideas behind extending methods and delegates, this is where...
3
by: Redefined Horizons | last post by:
I'm trying to understand the argument flags that are used in the method table of an extension module written in C. First let me ask this question about the method table. Is it an C array named...
1
by: jeremito | last post by:
I am trying to learn how to extend and/or embed Python. I have looked at the document "Extending and Embedding the Python Interpreter" and also "Python/C API Reference Manual. In the examples...
6
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...
7
by: Maximus Decimus | last post by:
HI all, I am using python v2.5 and I am an amateur working on python. I am extending python for my research work and would like some help and guidance w.r.t this matter from you experienced...
0
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.