473,322 Members | 1,703 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,322 software developers and data experts.

PInvoke, load library from desired folder?

It seems DllImport() only handles the filename, no folders.
I have a (rather heavy) workaround to preload the dll but can it be done in
a more easy way?

Currently:
<DllImport("MYDLL.DLL")> _

Would like (or similar):
<DllImport("~/bin/MYDLL.DLL")> _

Nov 20 '05 #1
3 1767
I'm not totally sure; but the option that you would like ( using the ~)
may not work. I have never seen code for DllImport referenced like
that. I think you must use Absolute file references like
c:\mydlls\mydll.dll.

However, if you place your dll in the system32 directory you can
reference the dll just by using the file name. You may be already doing
that; but just stating this for the benefit of everyone.
-HTH

Nov 20 '05 #2
Maybe this is done to avoid multiple and different instances in ASP.NET/IIS.

The full path didn't work, i tried that already.


"tdavisjr" <td******@gmail.com> schreef in bericht
news:11*********************@g49g2000cwa.googlegro ups.com...
I'm not totally sure; but the option that you would like ( using the ~)
may not work. I have never seen code for DllImport referenced like
that. I think you must use Absolute file references like
c:\mydlls\mydll.dll.

However, if you place your dll in the system32 directory you can
reference the dll just by using the file name. You may be already doing
that; but just stating this for the benefit of everyone.
-HTH

Nov 20 '05 #3
one thing to remember, when your asp.net page is running, the current
directory (thus the default dir), is windows\system32 dir (where the asp.net
service is running from), not the dir where the page is running from.

-- bruce (sqlwork.com)
"Edwin Knoppert" <ne**@hellobasic.com> wrote in message
news:43**********************@text.nova.planet.nl. ..
It seems DllImport() only handles the filename, no folders.
I have a (rather heavy) workaround to preload the dll but can it be done
in a more easy way?

Currently:
<DllImport("MYDLL.DLL")> _

Would like (or similar):
<DllImport("~/bin/MYDLL.DLL")> _

Nov 20 '05 #4

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

Similar topics

5
by: Rudolf Ball | last post by:
Dear NG, i want to load a plugin (WinForm) in my Applikation. That works fine. Now I want to globalize that plugin. So I have to load the Satellite Assembly, as well. But how can I load this...
3
by: Brett Robichaud | last post by:
I have created a simple background thread to make one pinvoke call into a DLL I've created. My Winforms app spawns the thread in the form load event then go about it's business. The problem is...
2
by: Craig | last post by:
I've seen many examples of how to call SHGetFileInfo in shell32.dll to get a files associated icon, but I can't find anywhere how to get the file information (size, last date modified, etc, etc)...
0
by: Claire | last post by:
Hi Ive been using Mattias Sjögren's example at http://www.msjogren.net/dotnet/eng/samples/dotnet_dynpinvoke.asp to load an unmanaged 3rd party dll dynamically when my object is created. Calling...
4
by: John Dann | last post by:
I'm trying unsuccessfully to access some functions within an external DLL; sorry I don't know much about DLL classification, but AFAIK it's not an ActiveX DLL, but a vanilla one written probably...
6
by: Andy Sutorius via DotNetMonster.com | last post by:
Using the code below the browser just sits and spins. The dll is located in the root of the web app. System.Runtime.Interop is in the using statements. I have tried this in ASP.NET 1.1 and 2.0 and...
2
by: peter.drienovsky | last post by:
Hello, let me describe my problem: ENVIRONMENT: ..Net 2.0, MSVS 2005, c#, WinXP SYMPTOMS: If assembly 'AgentDesktop' IS NOT in the (loading) application folder,
5
by: Alias | last post by:
Hi - I'm trying to implement a custom RoleProvider based on the SqlRoleProvider. I keep receiving a an error that it can't load type 'MyRoleTest.MyRoleProvider' when trying to load my...
14
by: Mohamed Mansour | last post by:
Hey there, this will be somewhat a long post, but any response is appreciated! I have done many PInvoke in the past from C++ to C#, but I did PInvoke within C# not C++/CLI. Can someone explain...
4
by: Andy B | last post by:
I have 2 web applications: ParentApp and ChildApp. The ChildApp root folder is setup like this: ParentApp/ChildApp. I set the output folder of the ChildApp under the build section in VS2005...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.