0
votes

I'm writing a project in VS 2017 that utilizes the Windows 32 bit version of SWI Prolog. I'm using the SWI Prolog C++ interface in another project that compiles with MSVC, using a C++ header and a .a static library to go with it.

I got everything linked together fine so that the projects runs okay in the local debugger mode for VS. However, when I try to use the compiled .exe, I get a linker error:

The procedure entry point __divmoddi4 could not be located in the dynamic link library C:\ProgrammingLanguages\swipl-32\bin\libswipl.dll

After some Googling I saw that this function is unique to newer versions of GCC, and it makes sense that the SWI Prolog library uses it considering it was cross compiled using MinGW.

The problem is I need this executable to work on its own, but I have no idea how to get the project to resolve this linker error without straight up switching to GCC. Is there any way I can resolve this linking error while still using MSVC?

I read some other threads about using extern "C" to resolve the problem but I get compiler errors since there's overloaded functions in the header I'm using. Unless I need to use the C header for SWI Prolog instead?

2

2 Answers

0
votes

It seems that it tries to use different DLL versions in debugger and as a standalone EXE. Run the project in the debugger and check which DLLs it loads (there is a special pane somewhere in VS). Then make sure it can find the same DLLs when you run it as a standalone executable (e.g. put them in the same folder as the EXE).

0
votes

Never found a true solution to this, but just an old way around. I rolled back SWI Prolog and grabbed an older version that actually had the static libraries built and available for Windows.