none
Where to install native dll for interop with managed class library? RRS feed

  • Question

  • Hello all, I hope this is the correct forum for my question.

    I've written a managed class library for .NET 4 that internally makes use of 2 native dlls - one compiled for a 64-bit target and one for a 32-bit target. At runtime my classes check if the current process is 64-bit or 32-bit and PInvokes the corresponding function in the proper dll. For testing I've just been copying the native dlls into the same directory that contains the executable that references the managed assembly, but it would be very inconvenient for customers if they had to do the same. Is there some global directory (or directories) that I can install the 32-bit and 64-bit native dlls to so that the customer need only add a reference to the managed assembly and these locations will be checked for the presence of the dlls automatically behind the scenes when pinvoking during execution?

    Thanks in advance.

    Thursday, March 28, 2013 2:43 PM

Answers

  • Install the 64 bit dll to program files and the 32 bit dll to program files (x86). Reference the dll as program files.

    Or if both are required in GAC, install to the 64 bit and 32 bit versions og GAC.



    Visual C++ MVP

    Friday, March 29, 2013 1:59 PM