Ruby 请教 ruby 如何调用一个 dll 动态库

ghn645568344 · January 11, 2022 · Last by w7938940 replied at January 11, 2022 · 362 hits

如下,在 C++ 中可以调用成功一个自定义的 DLL 库

HINSTANCE hDllInst;
hDllInst = LoadLibrary(L"SUDll.dll"); //调用DLL

typedef int(*PLUSFUNC)(std::string fileName[], size_t fileNameNum, std::string filePath); //后边为参数,前面为返回值
PLUSFUNC mergeSKP = (PLUSFUNC)GetProcAddress(hDllInst, "mergeSKP"); //GetProcAddress为获取该函数的地址

std::string fileName[2] = { "model.skp","model3.skp" };
std::cout << "=====开始生成=======" << std::endl;
std::cout << mergeSKP(fileName,2,"new_model.skp") << std::endl;
std::cout << "=====生成结束=======" << std::endl;
system("pause");

请问这个在 ruby 应该如何写?

You need to Sign in before reply, if you don't have an account, please Sign up first.