Building a C++ extension for Python 3.5 on Windows
Why Stack Overflow recommends it
Stack Overflow users link it when they need a concrete walkthrough for compiling a native Python extension on Windows and getting the .pyd file to import.
Recommended by 2 people across 2 different months, 2020 to 2023.
What it is
A 2016 screencast by Michael V showing how to build a C++ extension module for Python 3.5 on Windows using Visual Studio 2015, updating his earlier tutorial. It walks through project setup, compiling to a DLL, and producing a .pyd file that Python can import.
What people said
Recommends yuri · 2020-03 · Stack Overflow · on “import built from source libraries to python”
excuse my long comment I have already crossed this in fact this is video documented here [this video] , in my case the project building generated a huge directory (and subfolders) full with hpp header couldnt include them in the c++ file. I feel like I have everything the libs the dlls the hpps but cannot run this in python. actually I know the main reason I just couldn't **build the .pyd file** I am struggling trying this since 8 days now I followed many tutorials asked 3 desperate question in stackoverflow the cv2.pyd is simply always not there
Recommends geoff22873 · 2023-11 · Stack Overflow · on “compile CPython extension written in Zig on Windows”
Having seen this video [this video] I realized all I needed was to rename my simple.dll to simple.pyd Here's a working minimal example. Create simple.zig as below const py = @cImport({ @cDefine("PY_SSIZE_T_CLEAN", {}); @cInclude("Python.h"); }); const std = @import("std"); const print = std.debug.print; const PyObject = py.PyObject; const PyMethodDef = py.PyMethodDef; const PyModuleDef = py.PyModuleDef; const PyModuleDef_Base = py.PyModuleDef_Base; const Py_BuildValue = py.Py_BuildValue; const PyModule_Create = py.PyModule_Create; const METH_NOARGS = py.METH_NOARGS; fn hello(self: [*c]PyObject, args: [*c]PyObject) callconv(.C) [*]PyObject { _ = self; _ = args; print("welcome to ziglang\n", .{});
Cites axel_ande · 2022-10 · Stack Overflow · on “No symbols loaded for c++ in mixed debugging (from Python)”
I have a large project where the major part computation-heavy stuff is written in C++, and the "glue code" and the start script are written in Python. The code has been compiled with the VS 2017 compiler (V141) and Python 3.7.0-32bit for a few years now, and I want to upgrade to V143 and Python 3.10-64. I can build and run the code with the new environment. I get some small errors when I run the test suite (probably due to the change from 32-bit to 64-bit). The issue occurs when I try to debug the C++ code in Visual Studio 2022. I can debug the Python code without any errors, but when I want to debug the code, I can't get any symbols from the C++ to load. I've tried to follow this guide: [LI