Some linking error

Hello! I’m building the latest develop commit b13a67 with the script

cmake -G "Visual Studio 17 2022"\
 -DCMAKE_GENERATOR_PLATFORM=x64 -A x64 -DUSE_SCOTCH=OFF -DUSE_VTK=OFF -DUSE_ELAS=OFF -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=TRUE -DLIBMMG_SHARED=ON -DCMAKE_GENERATOR_TOOLSET="v143" ..
set CL=/D_CRT_SECURE_NO_WARNINGS=1 %CL%
cmake --build . --config Release

and the linking fails with


even though the function MMG5_chkmesh and so on are clearly present.
No clue what might be the issue here (some CMake hickup?); It might very well not be mmg’s problem but maybe someone here has an idea nevertheless.
On a related note: would it make sense / be interesting to write a hand-curated solution file for building mmg.dll, in addition to the CMake script, just for those cases where invoking CMake might be difficult? If I’m not mistaken, the only difficulty in doing so would be to decide how to process the two files with .in extension in the directory src/common. All other source files could just be compiled as-is into the dll. If it would make sense, I can try to set up a PR. I have the impression that some “CI/CD pipelines” can sometimes look simpler, or at least easier to reproduce, without CMake. What do you think?
Cheers, M

Hi Mathias,

I have corrected some linking errors (int the branch feature/MSVC17-LNK2019-errors) but that seems different from yours (that I am not able to reproduce) so I don’t know if it solves your issues.

In your case, errors seems to be related to the way we use function pointers… Honnestly, I am not sure that these errors are due to CMake, we are probably doing something that is not compliant with the C norm (but I don’t know why and without reproducing the bug it is hard to find what happens).

Just note that when trying to solve the error I have broken the cmake installation used by Jenkins so continuous integration is broken on windows now. I hope that I will fix this fast.

Thanks a lot for your proposition on hand-curated solution file but honestly I am not sure to be able to maintien it (I only have a ssh + command line access to my windows slave so it can be a limitation to development in certain cases).
Also, I don’t know what it implies in term of development, if having a solution file can conflict with the cmake script, how to test automatically that it works, etc…
Maybe it’s not worth your time to code this if I’m not sure to integrate it at the end.

In any case, thanks again for your feedback and I keep my fingers crossed that the linking errors have magically disappeared…

Best,
Algiane