Missing module/dependency when a C++ DLL is called by .Netframework app (PCL & CGAL)

0

I created a code in c++ to do some calculations with PCL and CGAL. I now wanted to add a UI. To do this I plan on creating a UI in a C# .Netframework app which will then call my C++ DLL, by following this tutorial (https://docs.microsoft.com/en-us/visualstudio/debugger/how-to-debug-managed-and-native-code?view=vs-2019).

Most parts of the code work but there are some lines which cause issues and I can't tell what the issue could be. Based on the error it seems that a dependency may be missing, but since the code runs fine as a c++ application I cant see how that could be.

Lines that I have identified to cause issues:

1:
pcl::io::savePCDFileASCII("test_pcd.pcd", cloud);

2:
Poisson_reconstruction_function function(points.begin(), points.end(), Point_map(), Normal_map());

3:

//Does not work with: typedef CGAL::Parallel_tag Concurrency_tag;
//Works with: typedef CGAL::Sequential_tag Concurrency_tag;
CGAL::pca_estimate_normals<Concurrency_tag>(points, nb_neighbors,
                CGAL::parameters::point_map(Point_map()).normal_map(Normal_map()));

In the last case the parrallel execution seems to be an issue. For the other lines I was not able to find a solution.

Does someone know what is missing to make the code work and why is it only a problem when it is compiled as a DLL and not a c++ executable ? Please let me know what other information would help.

Thank you!

The error I am shown is:

Exception thrown: 'System.DllNotFoundException' in MIxed_Mode_Calling_App.exe
An unhandled exception of type 'System.DllNotFoundException' occurred in MIxed_Mode_Calling_App.exe
Unable to load DLL 'C:\Users\d\Box\Daniel\RE\Surface Project\PCL_Project\MixedMode\build\Release\MixedMode.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

This question is related: Calling a C++ function from C# program

Edit: I have used the dependency walker to find potentially missing dependencies. It shows hundreds of dependencies missing, but many of them seem to be false positives. Here are the missing modules, from the first two there are many different variants: API-MS-WIN-..., EXT-MS-..., HVSIFILETRUST.DLL, IESHIMS.DLL

c#
c++
point-cloud-library
cgal
.net-framework-4.8
asked on Stack Overflow Nov 3, 2020 by Schimpf • edited Nov 5, 2020 by Schimpf

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0