我们的团队开发了一个 C++ CUDA DLL 和一个使用我们的 DLL 的 C# .NET 4.5 HMI。
这些程序最初计划仅适用于 64 位平台。
最近我们的客户要求我们也为 32 位平台提供我们的开发。
我们设法编译了 32 位的 DLL 和 HMI。
所以我们现在有两种配置:
- 使用 CUDA DLL x64 的 HMI x64
- 使用 CUDA DLL x86 的 HMI x86
64 位配置完美运行。
32位配置有一些问题:
- 只有一些导出函数可用
- 不可用函数调用抛出异常:在
中找不到入口点
使用 Dependency Walker 探索我们的 32 位和 64 位 dll 向我们展示了所有导出的函数。 (只有错位的名称在 32 位和 64 位之间变化)
以下是一些可用导出函数的原型(prototype):
extern "C" RetourInit __declspec(dllexport) __stdcall initGPU();
extern "C" Retour __declspec(dllexport) __stdcall setImageGpu(int idGPU, int nbImages, Image * listeImages);
extern "C" Retour __declspec(dllexport) __stdcall getImageGpu(int idGPU, int nbImages, Image * listeImages);
extern "C" Retour __declspec(dllexport) __stdcall duplicateImage(int idGPU, int nbImages, Image * listeImages);
以下是一些不可用导出函数的原型(prototype):
extern "C" Retour __declspec(dllexport) __stdcall decoupe(int idCarte, Decoupe paramDecoupe);
extern "C" Retour __declspec(dllexport) __stdcall fusion(int idCarte, Fusion paramFusion);
如果您有任何解决方案建议或问题,我们将很高兴听到。
谢谢大家。
最佳答案
问题是由于没有使用指针传递 Fusion 和 Decoupe 结构。
我们只是将原型(prototype)更改为:
extern "C" Retour __declspec(dllexport) __stdcall decoupe(int idCarte, Decoupe* paramDecoupe);
extern "C" Retour __declspec(dllexport) __stdcall fusion(int idCarte, Fusion* paramFusion);
并调整我们的 DLL 代码。我们的 C# HMI 没有改变。
此修改适用于 x86 和 x64。
很奇怪 64 位平台不受此修改的影响...
感谢您的评论。
关于c# - 找不到 32 位 DLL 的入口点。使用 64 位 DLL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24289496/