код Python
Код: Выделить всё
import ctypes
dll : ctypes.WinDLL = ctypes.windll.LoadLibrary("my.dll")
Name = dll.Name
c_text = ctypes.create_string_buffer(128)
c_text.value = b'Hello World'
Name.argtypes = (ctypes.c_char_p,)
Name.restype = ctypes.c_char_p
result = Name(c_text).decode('utf-8')
Код: Выделить всё
[DllExport("Name", CallingConvention = CallingConvention.StdCall)]
private static string Name(string name){
return name
}
код С#
Код: Выделить всё
[DllExport("Image", CallingConvention = CallingConvention.StdCall)]
private static string Image(IntPtr ScreenCapture){
try{
img = (Bitmap)Image.FromHbitmap(ScreenCapture);
return "Ok";
}
catch{
return "Error";
}
}
Я знаю, что intPtr похож на void*, но я понятия не имею, как использовать ctypes.POINTER(ctypes.c_void_p) и PIL.Image.open( ).
Подробнее здесь: https://stackoverflow.com/questions/784 ... rom-python