-1

I have created a Dll file from c++, I then called it in a c# file. It is working fine.

But then when I tried to export the files in another computer. I was getting this exception : DLL not found.

I downloaded dependency walker to fix the bug, because I thought my DLL depended on other DLLs that were missing in the second computer; I then downloaded the missing DLLs.

Yet I am still getting the same error.

Dependency Walker also gives me this message : The application has failed to start because its side-by-side configuration is incorrect. Do you think it might be a clue?

Kindly assist. Thank you

dede9714
  • 73
  • 2
  • 13
  • Are the DLL's the "same bitness" (64 or 32-bit)? – Mats Petersson Oct 28 '14 at 09:05
  • can you see the name of missing dll's in Windows Log? – Ali Kazmi Oct 28 '14 at 09:06
  • You don't mention what dlls were missing, I presume it is the C++ runtime. For the versions of VC++ that used SxS, it is best to use the runtime installer to install them. SxS has a number of catches to it that are best avoided by using the correct installer. – Niall Oct 28 '14 at 09:06
  • Mats Petersoon, YEs I ensured the "bitness" is the same 32-bits Ali Kazmi , No it doesn't give me the name. Dependency Walker gave me one that I have already downloaded. Niall, How do I fix the C++ runtime problem? can you explain it more please? thanks all for your prompt answers – dede9714 Oct 28 '14 at 09:09
  • W.r.t the SxS, what version of VS is used for the C++ dll? You mention it is 32-bit. Google "VSxxxx" C++ runtime, download the 32-bit version. If you dig around the VS installation, the runtimes are there, but downloading it is much faster. – Niall Oct 28 '14 at 09:13
  • Thanks Niall, I am in it now – dede9714 Oct 28 '14 at 09:16
  • 1
    You can find the name of missing dll in the Event Viewer, Windows Logs, Application. – Alex F Oct 28 '14 at 09:30

3 Answers3

0
  • You will need to install appropriate VC++ runtime on client machine. The VC++ runtime must match with the bitness (32-bit or 64-bit), and with the service pack you are using (See About dialog box - left side, not right side (which is of .NET)).
  • You may use /MT compiler option to get all of dependent DLL into your DLL (or EXE).
  • If you are using MFC, use 'Use MFC in Static Library'
Ajay
  • 18,086
  • 12
  • 59
  • 105
  • HI All, I have tried un-installing and re-installing the Microsoft Re-distributable but the problem is still there. Dependency Walker reported that MSVCR80D.DLL was missing and I thought I installed it properly. Yet in Event Viewer the Events is recorded as : Activation context generation failed for "c:\dll_en\DES_EN_20140123DLL.DLL". Dependent Assembly Microsoft.VC80.DebugCRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.762" could not be found. Please use sxstrace.exe for detailed diagnosis. I am a bit clueless now – dede9714 Oct 28 '14 at 11:04
  • 80D - here you go. You need to build Release build, and not Debug build. Check Release folder! – Ajay Oct 28 '14 at 11:05
  • Ajay, from the release folder i am also getting the same thing. Quite frustrating though, been on it the whole day... – dede9714 Oct 28 '14 at 14:26
0

What I have done so far

  1. I downloaded Dependency Walker to check for any missing dependent DLL.
  2. Dependency Walker revealed that a side-by-side configuration was incorrect and suggests to trace the event with sxstrace.exe tool (command prompt) : http://ntcoder.com/bab/2014/02/27/troubleshooting-side-by-side-issues-using-sxstrace/

  3. Then I confirmed the nature of the error with event viewer which gave me the following message : Dependent Assembly Microsoft.VC80.DebugCRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.762" could not be found. Please use sxstrace.exe for detailed diagnosis.

  4. I installed the version Microsoft Visual C++ 2005 SP1 Redistributable Package (x86) 8.0.50727.762 from http://www.microsoft.com/en-us/download/details.aspx?id=5638. because apparently the problem seems to come from the fact that my DLL was compiled with VC80 CRT and need one to run.

  5. I then went back on the primary computer only to recheck and find out that it was a 64 bits, I am sure that is were the mistake is coming from. Sorry for not picking this up from the start.

dede9714
  • 73
  • 2
  • 13
0

The main problem was that the first computer was a 32 bit And the second a 64 bit. I reloaded DLL files from my source code(the one generating DLLs) using the second computer and it was working fine.

In the program that was making use of the DLL, I inserted a code to test whether the host is 32 or 64 bit and I would call the respective dll.

It worked fine. Thanks to everyone

dede9714
  • 73
  • 2
  • 13