NX二次开发-调系统命令UF_load_library[UFUN调DLL]

此函数可以调DLL,可以调宏,当然也可以调其他内部函数(知道哪个内部函数怎么用的前提下)。

 1 #include <uf.h>
 2 
 3 
 4 void UFUN_API_Call_DLL(char* dllPath)
 5 {
 6     //调系统命令
 7     typedef void(*load_ufusr_f_p_t)(char* param, int* retcode, int paramLen);
 8     load_ufusr_f_p_t load_ufusr_ptr = NULL;
 9     int irc = UF_load_library(dllPath, "ufusr", (UF_load_f_p_t *)& load_ufusr_ptr);
10 
11     //调用DLL
12     if (load_ufusr_ptr != NULL)
13     {
14         int retcode;
15         load_ufusr_ptr(dllPath, &retcode, 1);
16     }
17 
18     if (irc != 0)
19     {
20         uc1601("failed load", 1);
21         UF_unload_library(dllPath); // 注意该语句只能在失败时被调用,否则UG会退出
22         return;
23     }
24 }
25 
26 
27 UFUN_API_Call_DLL("E:\11111\2.dll");
28 
29 Caesar卢尚宇
30 2019年11月24日

原文地址:https://www.cnblogs.com/nxopen2018/p/11921313.html