Skip to content

Instantly share code, notes, and snippets.

@yuhangch
Created March 6, 2020 09:22
Show Gist options
  • Save yuhangch/7045cda00d105a6189b6f556d9fb3c62 to your computer and use it in GitHub Desktop.
Save yuhangch/7045cda00d105a6189b6f556d9fb3c62 to your computer and use it in GitHub Desktop.
Python3 Call dll (c++) Function
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