Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Program works only on some pc, DLL missing?

I wrote with VS10 the following projects:

  • a C# (.net 4.0) program which calls
  • a C++ unmanaged dll, which make use of boost::thread
  • a setup project which includes the C# executable, the C++ dll, the boost::thread dll and some other files. Moreover during the installation there is a check if the framework .net 4.0 is installed, and if not it will be downloaded.

The compilation (x64 for each of the three projects) is ok, and the program works on my pc (Windows 7 64bit). I tested the program on some other computers (all Windows 7 64bit) and I noted that:

  • in the ones with VS10 and Boost the program works
  • in the ones without VS10 and Boost the program gives an error in the C++ Dll

I think the problem is that some boost Dll is missing. Am I right? Or the problem could be related to VS?

edit:

I have to mention that the structure of the program is the following:

  • main form (C#) in which some parameters are set, then a backgroudworker calls
  • the C++ DLL which do its stuff and uses boost::thread
    • it does some computations
    • when it get some results, writes them on file
    • continue with its computations and so on
  • the main form has a filesystemwatcher which looks for the results file and do some stuff with the results.

Also, when I get the error, the main form correctly loads and the parameters could be set. The error happens when the backgroundworker starts his work (calling the C++ DLL).

So I'm quite sure that there is no problem with the framework installation.

Update:

It turns out that I forgot to include some DLLs in the setup project. Now, including them the error changed.

Now, at the same point as before (and on the same computers) I get another error:

BadImageFormatException: An attempt was made to load a program with an incorrect format

I read this article, but I have set x64 in both C# project and in C++ DLL and the setup project has as TargetPlatform x64. Any idea?

like image 777
888 Avatar asked Jul 18 '26 10:07

888


1 Answers

VCRedist package is missing on target machine. It should be available in VS SDK directory. Also you may need to install .Net Framework on target machine (.Net Framework contains VCRedist package). If you don't have instalation files for those, they are available on microsoft sites i.e. VC10Redist for x64 is here

like image 99
Kamil Klimek Avatar answered Jul 20 '26 23:07

Kamil Klimek



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!