tags:

views:

31

answers:

2

I use PInvoke on a win32 DLL and i've currently placed it in my System32 folder. Is there an alternative to this? What if my app needs to be deployed somewhere where i dont have access to system folders?

+3  A: 

So long as the DLL is present somewhere on the Path that is used by the app, it should get loaded properly. The approach you have described here works because of this trait: System32 is always in the path.

Here is some more info on how DLLs are located for loading. Your app can know its own path via

System.Environment.GetEnvironmentVariable("Path");
Steve Townsend
What do you mean path used by the app?
smkngspcmn
@smkngspcmn - `System.Environment.GetEnvironmentVariable("Path");`
Steve Townsend
@smkngspcmn read about Path environment variable
Eugene Mayevski 'EldoS Corp
A: 

Please don't put it in System32. You will make your install more complicated than it needs to be. Just put it in the same folder as the exe. Save System32 for, you know, system stuff.

Kate Gregory