pybind11 python37_d.dll access violation 1

pybind11 python37_d.dll access violation

Turns out that pybind11 undefines _DEBUG
which causes Py_DEBUG not to be defined as well,
so one must explicitly define it in VS Preprocessor tab in order to avoid crashes
because of the size difference between the structures on pybind11 and python36_d sides.

Source: https://github.com/pybind/pybind11/issues/1293

Here is what the above code is Doing:
1. It’s creating a new class called “MyClass” that inherits from the “object” class.
2. It’s creating a new function called “__init__” that takes two arguments: “self” and “name”.
3. It’s creating a new variable called “name” and setting it equal to the “name” argument.
4. It’s creating a new function called “greet” that takes one argument: “self”.
5. It’s printing “Hello” and the value of the “name” variable.
6. It’s creating a new variable called “MyClass” and setting it equal to the class we just created.
7. It’s creating a new variable called “my_object” and setting it equal to an instance of the “MyClass” class.
8. It’s calling the “greet” function on “my_object”.

Similar Posts