“The procedure entry point… could not be located”

2019-06-16 03:43发布

问题:

I have created a DLL from Haskell code and I am calling this DLL from C++. My application works fine when I run it in Debug mode in Visual Studio 2010, but when I make a Release build and install it, I get the error

The procedure entry point LVSpecData_GetGlob could not be located in the dynamic link library SpectrumMath.dll.

SpectrumMath.dll is my Haskell-based DLL. The weird thing is that the function LVSpecData_GetGlob isn’t in that DLL—it’s in another DLL I link against, and nothing about that DLL or my application’s use of it changed when I added the Haskell DLL.

This error message seems to be saying that Windows is confused about which functions live in which DLLs. What could be going wrong here?

回答1:

This looks to be a bug in Visual Studio 2010 Release mode (Haskell dll functions are not imported by exe built in Release mode hence Haskell dll is not loaded, in Debug imports are present and it works fine).

The same exe project built in Release mode using Visual Studio 2013 Update 4 and Visual Studio 2015 RC works fine.



回答2:

Have you tried using .def file to define exports? https://msdn.microsoft.com/en-us/library/d91k01sh.aspx

After you create it, you must edit project properties Linker->Input->Module definition file



标签: c++ haskell dll