Importing C++ CLR wrapper DLL into Python
I made a C++ CLR DLL (libwrapper.dll) that imports a C# DLL (lib2.dll):
include <stdio.h>
using "lib2.dll"
extern "C" __declspec(dllexport) int __cdecl getid() {
return (MyCls::getid());
}
This is a kind of hello world program...
Now from python, I do:
from ctypes import *
lib=WinDLL("./libwrapper.dll")
lib.getid.restype=c_int
lib.getid.argtypes=()
print(f"Id = {lib.getid()}")
obtaining the error (in the last line):
Traceback (most recent call last):
File "lw.py", line 7, in <module>
print(f"Id = {lib.getid()}")
OSError: [WinError -532462766] Windows Error 0xe0434352
How can I avoid this error? Is there anything wrong in the code?
What are the options for compiling libwrapper.dll? In the command-line I tried cl libwrapper.cpp /LD /CLR