PyQt5调用dll,指针传参学习

1.生成的dll截图如下:

PyQt5调用dll,指针传参学习_第1张图片

注意生成的dll内部函数在cmd窗口中查看,不能出现@****(英文大写字母),否则格式会不对,python调用会失败,需重新编译dll;

2.内部函数在C++中声明如下:

3.pyqt中调用、传指针方式如下:

bes = cdll.LoadLibrary(r'transferdll.dll')
        burn_image_file = self.ProgramFile
        factory_image_file = "D:\PyQt_Project\PyQt5\BurningTool\\test.bin"
        custom_bin_file = self.AppFile
        ota_file = self.OtaFile
        bes.handle_buildinfo_to_extend(custom_bin_file)

        bin_path = (c_char * 50)(*bytes("test.bin",'utf-8'))
        param_btaddr = (c_char * 50)(*bytes("123456789012",'utf-8'))
        param_bleaddr = (c_char * 50)(*bytes("123456789012",'utf-8'))
        param_dongleaddr = (c_char * 50)(*bytes("123456789011",'utf-8'))
        dev_bt_name = (c_char * 50)(*bytes("bt_name",'utf-8'))
        dev_ble_name = (c_char * 50)(*bytes("bt_name",'utf-8'))
        default_xtal_fcap = c_uint(70)
        sn = (c_char * 50)(*bytes("00025",'utf-8'))

        ireturn=bes.sector_gen(bin_path,param_btaddr,param_bleaddr,param_dongleaddr,dev_bt_name,dev_ble_name,default_xtal_fcap,sn)

 

你可能感兴趣的:(PyQt5调用dll,指针传参学习)