Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Friends,
I am trying to convert plain c++ code int .dll file to be used in c# project. I recieve following message when I add reference to the *.dll (I have made from plain c++)
"A reference to 'D:\...\...\CLAHE.dll' could not be added. please make sure that the file is accessible, and a valid assemble or COM Component".
Please help how to do it.
Thank you
Posted

No, you cannot do it. References only reference assemblies. To use unmanaged DLL you need to use P/Invoke via System.Runtime.InteropServices. See http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.aspx[^].

You can find detailed explanation and basic code samples here: http://en.wikipedia.org/wiki/P/Invoke[^].

For more information, learn this:
http://msdn.microsoft.com/en-us/library/sd10k43k.aspx[^],
http://msdn.microsoft.com/en-us/library/26thfadc.aspx[^].

Some cases of [ImportDll] can be rather complex. If you're really lost, try to seek help at CodeProject and report all the details of the problem; in many cases we helped to find ends.

—SA
 
Share this answer
 
Comments
Espen Harlinn 20-Jul-11 19:05pm    
When you wan't to use a native dll, this is the way to do it - my 5
Sergey Alexandrovich Kryukov 20-Jul-11 22:02pm    
Thank you, Espen.
--SA
Hello,

You can follow this link and solve your problem
http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.aspx[^]

Find dll related tutorials and help here - http://msdn.microsoft.com/en-us/library/26thfadc.aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900