I want to import DLL file in my web site project. I have dll file "my.dll" in folder C:\DLLDir and I'm using the code :
[DllImport("C:\\DLLDir\\my.dll", EntryPoint = "Out32")]
This works ok. But I want to use relative path (web site root path) . I'm trying to put "my.dll" in "bin" or root folder and I'm using the code :
[DllImport("my.dll", EntryPoint = "Out32")]
but I'm getting the error: Unable to load DLL 'my.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
Any ideas?
ASP.NET is an open-source, server-side web-application framework designed for web development to produce dynamic web pages. It was developed by Microsoft to allow programmers to build dynamic web sites, applications and services. The name stands for Active Server Pages Network Enabled Technologies. ASP.NET (software)
ASP.NET is a web application framework developed and marketed by Microsoft to allow programmers to build dynamic web sites. It allows you to use a full featured programming language such as C# or VB.NET to build web applications easily.
No. The . NET Framework is a bunch of classes(libraries) abstracting some lower-level windows functionality. C and C++ are languages.
. NET was fully written in C and C++ because the base was in assembly language. Integration of assembly with C is much easier compared to newer languages.
I think you may want to check out the following SO question first (since it's related to your case):
DllImport failed to locate DLL even though it is in the PATH
As other people has suggested, check the PATH
environment variable to make sure that C:\DLLDir\
is there. You can read more about how to do configure your environment variables here.
Check out this MSDN forum post as well (seems like there was an issue with dependencies).
If it's a COM DLL you're importing then it might also requires to be registered first on a target machine (although I'm not sure if this is needed). Read more here.
Either you did not copy my.dll to Bin folder where it should be loaded. Using Process Explorer ( http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx) will likley show where it tries to load this file from.
EDIT: thanks to volpav for reminding that it is unmanaged DLL - ignore manged portion... ...assembly have some other dependencies. Check out http://blogs.msdn.com/b/suzcook/archive/2003/05/29/57120.aspx that details investiagtion of such failures (search for "assembly load fussion log" for more links).
Go to Properties/Build
tab, and set Platform target to x86
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With