【问题标题】:Entry point not found with 32bits DLL. Working with 64 bits DLL找不到 32 位 DLL 的入口点。使用 64 位 DLL
【发布时间】:2014-08-08 23:33:57
【问题描述】:

我们的团队开发了一个 C++ CUDA DLL 和一个使用我们的 DLL 的 C# .NET 4.5 HMI。

这些程序最初计划仅适用于 64 位平台。

最近我们的客户要求我们让我们的开发也可用于 32 位平台。

我们设法以 32 位编译 DLL 和 HMI。

所以我们现在有 2 个配置:

  • 使用 CUDA DLL x64 的 HMI x64
  • 使用 CUDA DLL x86 的 HMI x86

64 位配置完美运行。

32位配置有一些问题:

  • 只有部分导出的函数可用
  • 不可用的函数调用引发异常:在 中找不到入口点

使用 Dependency Walker 探索我们的 32 位和 64 位 dll 向我们展示了所有导出的函数。 (只有错位名称在 32 位和 64 位之间变化)

以下是可用导出函数的一些原型:

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);

以下是一些不可用的导出函数的原型:

extern "C" Retour __declspec(dllexport) __stdcall decoupe(int idCarte, Decoupe paramDecoupe);
extern "C" Retour __declspec(dllexport) __stdcall fusion(int idCarte, Fusion paramFusion);

如果您有任何建议或问题的解决方案,我们将很高兴听到。

谢谢大家。

【问题讨论】:

  • 我的猜测是 Decoupe 和 Fusion 类型有一些依赖于 64 位实现的依赖关系。其他导出的函数使用的是 vanilla 类型。
  • 感谢您的评论。以下是 decoupe 原型中使用的结构:struct Decoupe{ Image image; int nbBandes; Bande * bandes; };struct Image{ unsigned char * ptr; int largeur; int hauteur; int bpp; int tailleOctets; };struct Bande{ unsigned char * ptr; int largeur; int hauteur; int bpp; int pasX; int pasY; int posX; int posY; bool horizontale; bool reversed; }; 我没有看到任何 64 位依赖项实现。如果您有任何其他解决方案,我会很高兴听到。

标签: c# c++ dll cuda 32bit-64bit


【解决方案1】:

问题是由于没有使用指针传递 Fusion 和 Decoupe 结构。

我们只是把我们的原型改成这样:

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位平台不受这个修改的影响……

感谢您的 cmets。

【讨论】:

    猜你喜欢
    • 2022-01-20
    • 2015-01-07
    • 2012-10-17
    • 2013-06-08
    • 1970-01-01
    • 1970-01-01
    • 2011-05-12
    • 2013-09-26
    • 1970-01-01
    相关资源
    最近更新 更多