Created
March 6, 2020 09:22
-
-
Save yuhangch/7045cda00d105a6189b6f556d9fb3c62 to your computer and use it in GitHub Desktop.
Python3 Call dll (c++) Function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ctypes | |
from ctypes import * | |
string_raw = "char* args" | |
int_raw = 123 | |
args1 = c_char_p(string_raw.encode('utf-8')) | |
args2 = c_int(int_raw) | |
lib = ctypes.cdll.LoadLibrary("D:\\path\\to\\func.dll") | |
# example : function name is RUn | |
# first arg type is char* | |
# second arg type is int | |
lib.Run(args1,args2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment