PInvoke, load library from desired folder?

E

Edwin Knoppert

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")> _
 
T

tdavisjr

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
 
E

Edwin Knoppert

Maybe this is done to avoid multiple and different instances in ASP.NET/IIS.

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

Bruce Barker

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top