473,396 Members | 2,017 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

DLLImport and Unable to Load DLL

I have a C# function that calls into a C++ DLL

I have placed the DLL in the 'bin' folder of my asp.net project

I'm using something like
[DllImport("Keycode.dll", EntryPoint="GenerateKey")]

However when I try to call the function I'm getting an error 'Unable to Load
DLL'

Should I specifiy the path to the dll in the DllImport?
If so - do I specifiy a path relative to the web site or a physical path?

Anything else that could be causing this error?
--
Michael Tissington
Oaklodge Technologies
http://www.oaklodge.com/technology

Nov 17 '05 #1
2 1779
Michael,
Should I specifiy the path to the dll in the DllImport?


See http://www.dotnetinterop.com/faq/?q=LoadLibrary

On the platforms where it's available, you can also call the
SetDllDirectory API.

http://msdn.microsoft.com/library/en...ldirectory.asp

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.
Nov 17 '05 #2
Mattias,

Thanks for the LoadLibrary link, however this does not seem to work when
running as an ASP.NET web page.

I guess I need to get the path to the original location of the page and not
the temporary location of the assembly.

--
Michael Tissington
Oaklodge Technologies
http://www.oaklodge.com/technology

"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:u8**************@TK2MSFTNGP10.phx.gbl...
Michael,
Should I specifiy the path to the dll in the DllImport?


See http://www.dotnetinterop.com/faq/?q=LoadLibrary

On the platforms where it's available, you can also call the
SetDllDirectory API.

http://msdn.microsoft.com/library/en...ldirectory.asp

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: mike | last post by:
I have a form that uses a C++ dll through DLLImport. Then I created a new project and had Form1 inherit the DLL form. I can run it without problem, but I cannot open the derrived form in the...
4
by: Michael Tissington | last post by:
I have a C# function that calls into a C++ DLL I have placed the DLL in the 'bin' folder of my asp.net project I'm using something like However when I try to call the function I'm getting...
15
by: Jim | last post by:
I am extremely frustrated. I am building c# application for a call center and am using a third party API to access some hardware. When develop and test my class using the windows console the...
2
by: pnp | last post by:
Hi all, i'm having a problem using DllImport with Win98. It works just fine with XP & 2000 but in 98 it prompts: "Unable to find xxxxx.dll". Any ideas? error is: System.DllNotFoundException:...
2
by: Brian Anderson | last post by:
Hello, is it possible to use DllImport to call a DLL in ASP.NET ? Or is it necessarry that my DLL has to be copied into \System32 ? My DLL is a native C++ 7.1 DLL (not managed, no COM, no...
6
by: Steve | last post by:
I'm sure I'm missing something basic. I have an class library that uses an unmanaged dll. Let's say the class library is called "CL1.dll" and is located at: and the unmanaged dll is called...
1
by: nirbhay | last post by:
Hello All I am experiencing a problem calling one of my un-managed C++ DLL from a Web page This was working fine in Visual Studio 2003 version but gives following error in Visual Studio 2005...
0
by: kayakyakr | last post by:
I'm working with a set of experiments in a large system that is using AppDomains for isolation and wants to make a call out to an umanaged dll. The test dll has two methods, SetNumber(int num) and...
4
by: =?Utf-8?B?Q2hyaXM=?= | last post by:
I have my own win app developed in VS C# 2005. This app uses a dll file (I import methods from the library by dllimport attribute). The dll file is provided by another program (let's call it...
1
by: =?Utf-8?B?VHJlY2l1cw==?= | last post by:
Hello, Newsgroupians: I have created an unmanaged DLL using Visual Studio 2005, which was created in Visual C++. I have some functions in the DLL that I am trying to call. When I "dumpbin...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.