Creo二次开发基于C++、C#混合编程
1.创建C++动态链接库项目

2.编辑C++ 函数 代码dllmain.cpp
#include "pch.h"
#include <ProMdl.h>
#include <ProToolkit.h>
#include <ProUtil.h>
#include <ProMessage.h>
#include <windows.h>
extern "C" __declspec(dllexport) ProMdlType MdlRetrieve(char *name,ProMdlType type,ProMdl **mdl)
{
mdl = NULL;
//宽字符串转换为多字节字符串
int bufSize = MultiByteToWideChar(CP_ACP, 0, name, -1, NULL, 0);
wchar_t* wp = new wchar_t[bufSize];
MultiByteToWideChar(CP_ACP, 0, name, -1, wp, bufSize);
ProError err = ProMdlRetrieve(wp, type, *p_handle);
return type;
}
extern "C" __declspec(dllexport) int Sub(int a,int b)
{
int c = a+b;
return c;
}
extern "C" int user_initialize() {
return 0; }
extern "C" void user_terminate() {
return; }
extern "C" int __imp_getaddrinfo() {
return 0; }
extern "C" int __imp_freeaddrinfo() {
return 0; }
extern "C" int __imp_getnameinfo() {
return
免责声明:本文系网络转载或改编,未找到原创作者,版权归原作者所有。如涉及版权,请联系删