How to compile python extension in vc6

Source: Internet
Author: User
Some CC ++ codes need to be used in Python and do not want to be converted into python, so they are written as python extensions for calling, compiling python extension process system environment in VC6: VC6 + Python-2.5.4

1. download the Python-2.5.4 source code.

2. decompress the package and open D: \ Python-2.5.4 \ PC \ VC6 \ pcbuild. dsw, compile, and D: \ Python-2.5.4 \ PC \ VC6 \ to obtain python25.dll, python25_d.dll, python25.lib, and python25_d.lib.

3. use VC6 to create a dynamic link library project, copy D: \ Python-2.5.4 \ PC \ example_nt \ example. c to the project directory, and add it to the project.

4. set up the project.

The code is as follows:


Open tools-> options-> directories, add D: \ PYTHON-2.5.4 \ INCLUDE to program files, and add D: \ PYTHON-2.5.4 \ PC \ VC6 to Library files.
Open Progect-> Settings, change Win32 Debug-> Link-> Output file name to example_d.pyd, and change Win32 Release-> Link-> Output file name to example. pyd.

5. Compile.

6. try to call:

The code is as follows:


D: \ MY Project \ testpymodule \ Release> python
Python 2.5.4 (r254: 67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on
Win32
Type "help", "copyright", "credits" or "license" for more information.
>>> Import example
>>> Example. foo ()
Hello, world
>>>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.