Skip to content

Commit

Permalink
Refactor DllImport LoadLibrary functions
Browse files Browse the repository at this point in the history
This change refactors the code in DllImport in preparation
for implementing the new  NativeLibrary API here:
https://github.com/dotnet/corefx/issues/32015

In particular, it introduces a change in the semantics of the
internal LoadLibrary helper functions.

When a native library is loaded, there are two categories of callers
expecting different return values:
 * External callers like AssemblyNative::InternalLoadUnmanagedDllFromPath()
   and the upcoming System.Runtime.Interop.Marshall.LoadLibrary()
   need the raw system handle
 * Internal callers like LoadLibraryModule() need the PAL registered handle

This change modifies the internal LoadLibraryModule* methods to work
in terms of native system handles, so that external callers can obrain
them directly. Methods requiring PAL-handles can register them explicitly.

[PS: NDirect::LoadLibraryFromPath was already written to return the
system handle instead of the PAL handle. This change extends
the behavior to other private members.]

There is no change in external signature of DllImport class, or the
native Dll cache in AppDomain class.
  • Loading branch information
swaroop-sridhar authored and swaroop-sridhar committed Nov 7, 2018
1 parent 87dbecd commit ca59138
Show file tree
Hide file tree
Showing 2 changed files with 156 additions and 143 deletions.
Loading

0 comments on commit ca59138

Please sign in to comment.