VC6 ways to write Python extensions

Source: Internet
Author: User
System environment: VC6 + Python-2.5.4

1, download Python-2.5.4 source code.

2, decompression, open D:\Python-2.5.4\PC\VC6\pcbuild.dsw, compile, D:\Python-2.5.4\PC\VC6\ under Python25.dll, Python25_d.dll, Python25.lib, Python25_d.lib.

3, use VC6 to establish a dynamic link library project, copy the D:\Python-2.5.4\PC\example_nt\example.c to the project directory, and add 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 includes files, 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, Win32 release->link-> Output file name modified to Example.pyd

5, compile.

6. Try calling:

The code is as follows:


D:\MY Project\testpymodule\release>python
Python 2.5.4 (r254:67916, Dec, 15:10:54) [MSC v.1310 + 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.