"Extended and Embed Python Interpreter" 1.5 Compilation and Connection

xiaoxiao2021-04-04  251

1.5 Compilation and connection

There are two things to do before you use extensions: compile and connect with the Python system. If you use dynamic loading, details depend on your system user's dynamic loading style. For more information, constructing the extended module See (Chapter 3), as for other related information constructed on Windows, see (Chapter 4).

If you don't use dynamic loading, or, you want to make your module permanently become part of the Python interpreter, you must change the installation settings, and recompile the interpreter, this is very simple on UNIX, just place your file (SpamModule.c) to the modules / path and extract the shrinkage code package, add a line of documents to the modules / setup.local file: if You can't use Dynamic Loading, or if you want to make your module a permanent part of the Python interpreter, you will have to change the configuration setup and rebuild the interpreter luckily, this is very simple on Unix:. just place your file (spammodule.c for example) in the Modules / directory of an Unpacked Source Distribution, Add a line to the file modules / setup.local describing your file

Spam spammodule.o

And run the MAKE reconstruction interpreter on the top directory. You can also run Make in the 'Modules /' path, but at this time you must first run 'make makefile', reconstruct Makefile (each change the setup file, you must be re-refined).

If your module needs to connect additional libraries, these files also need to be listed in the configuration file, such as:

Spam spammodule.o -lx11

转载请注明原文地址:https://www.9cbs.com/read-131963.html

New Post(0)