2
votes

The Situation:

I'm trying to run CharLS JPEG-LS Compression algorithm implementation

There is source code in the site about where you can download a C# VS 2010 Solution. In the Solution there are, 2 C# Class Library Projects, 1 Unmanaged VC++ project and 1 C# Console App. The console App calls one of the class libraries, `using CharLS;', and that particular library references the unmanaged VC++ project. The console application works perfectly on debug mode.

The Problem:

But when I compiled the console app for "Release", and ran the .exe (executable file), when a particular function is called during the process, it gives me this error:

Error: Unable to load DLL 'CharLS.dll' : The specified module could not be found. (Exception from HRESULT: 0x8007007E)

I've also tried to create another project and reference the class library from there, but I get the same error.

I've tried reading other solutions for this over the net but they have not helped me.

3
One of CharLS.dll dependencies is not found - possibly because of changing current directory. Learn Dll dependencies in the Dependency walker dependencywalker.comAlex F
Have you checked whether the file CharLS.dll exists on the path on your development machine? If it does, then deploy it with the release software (also on the path). Alternatively, is it a registered file (regsvr32)? If so, deploy it and register it.Vicki
You never mentioned "and I made sure that the DLL was copied to the bin\Debug directory". So start there first. SysInternals' ProcMon utility can show what other DLL might be missing.Hans Passant

3 Answers

2
votes

Some of the reasons for this error could be:

  1. the name you are providing to the "EntryPoint" property of "DllImport" attribute is not matching with the function you are exporting from the native component.

  2. Another reason could be missing dll itself/or any of its dependencies(use dependency walker and check)

  3. Third reason could be it could be debug/release version mismatch.

0
votes

Have you (re-)built the project before run in Release mode? Looks like you didn't and release output contains no such lib. Check it anyway.

0
votes

Ensure it's definitely registered on the server. Also have you got the Application Pool (assuming IIS7+) set to allow 32-bit processes?