diff options
author | Swaroop Sridhar <Swaroop.Sridhar@microsoft.com> | 2018-11-21 11:42:01 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-21 11:42:01 -0800 |
commit | 175ba1c0794958bb7d006544b87e00675de742fc (patch) | |
tree | e5ef7a67f6c11a7407465661155036b958d6beb3 /src/vm/dllimport.h | |
parent | 5ef00810b53dcb7cbc4f2cb152ca6af971284e82 (diff) | |
download | coreclr-175ba1c0794958bb7d006544b87e00675de742fc.tar.gz coreclr-175ba1c0794958bb7d006544b87e00675de742fc.tar.bz2 coreclr-175ba1c0794958bb7d006544b87e00675de742fc.zip |
Introduce Marshall.LoadLibrary API (#20871)
Implement Native LoadLibrary API
This change commits the following changes:
1) Refactoring DllImport code to reuse LodLibrary by search for
pInvoke and LoadLibrary cases
2) Implement the new Native Library API in System.Runtime.Interop.Marshall
3) Add tests for the new APIs
Diffstat (limited to 'src/vm/dllimport.h')
-rw-r--r-- | src/vm/dllimport.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/vm/dllimport.h b/src/vm/dllimport.h index 05336b43c6..2f25e59570 100644 --- a/src/vm/dllimport.h +++ b/src/vm/dllimport.h @@ -5,9 +5,6 @@ // File: DllImport.h // -// - - #ifndef __dllimport_h__ #define __dllimport_h__ @@ -77,9 +74,13 @@ public: static HRESULT HasNAT_LAttribute(IMDInternalImport *pInternalImport, mdToken token, DWORD dwMemberAttrs); static LPVOID NDirectGetEntryPoint(NDirectMethodDesc *pMD, HINSTANCE hMod); - static NATIVE_LIBRARY_HANDLE LoadLibraryFromPath(LPCWSTR libraryPath); + static NATIVE_LIBRARY_HANDLE LoadLibraryFromPath(LPCWSTR libraryPath, BOOL throwOnError); + static NATIVE_LIBRARY_HANDLE LoadLibraryByName(LPCWSTR name, Assembly *callingAssembly, + BOOL hasDllImportSearchPathFlag, DWORD dllImportSearchPathFlag, + BOOL throwOnError); static HINSTANCE LoadLibraryModule(NDirectMethodDesc * pMD, LoadLibErrorTracker *pErrorTracker); - + static void FreeNativeLibrary(NATIVE_LIBRARY_HANDLE handle); + static INT_PTR GetNativeLibraryExport(NATIVE_LIBRARY_HANDLE handle, LPCWSTR symbolName, BOOL throwOnError); static VOID NDirectLink(NDirectMethodDesc *pMD); @@ -125,6 +126,7 @@ private: static NATIVE_LIBRARY_HANDLE LoadFromPInvokeAssemblyDirectory(Assembly *pAssembly, LPCWSTR libName, DWORD flags, LoadLibErrorTracker *pErrorTracker); static NATIVE_LIBRARY_HANDLE LoadLibraryModuleViaHost(NDirectMethodDesc * pMD, AppDomain* pDomain, const wchar_t* wszLibName); static NATIVE_LIBRARY_HANDLE LoadLibraryModuleBySearch(NDirectMethodDesc * pMD, LoadLibErrorTracker * pErrorTracker, const wchar_t* wszLibName); + static NATIVE_LIBRARY_HANDLE LoadLibraryModuleBySearch(Assembly *callingAssembly, BOOL searchAssemblyDirectory, DWORD dllImportSearchPathFlag, LoadLibErrorTracker * pErrorTracker, const wchar_t* wszLibName); #if !defined(FEATURE_PAL) // Indicates if the OS supports the new secure LoadLibraryEx flags introduced in KB2533623 |