Reputation: 2149
I am trying to run the application on Mono framework which is built on windows platform. I know that there are some platform specific Interop calls are used in it. While running the application in Mono with debug I got following message. I know that it is looking for LoadLibrary but my interest is to know about "__Internal", what does this mean?
Mono: DllImport attempting to load: '__Internal'.
Mono: DllImport loaded library '(null)'.
Mono: DllImport searching in: '__Internal' ('(null)').
Mono: Searching for 'LoadLibrary'.
Mono: Probing 'LoadLibrary'.
Mono: Probing 'LoadLibrary'.
Mono: Probing 'LoadLibraryA'.
Mono: Probing 'LoadLibraryA'.
Mono: DllImport searching in: '__Internal' ('(null)').
Mono: Searching for 'GetProcAddress'.
Mono: Probing 'GetProcAddress'.
Mono: Probing 'GetProcAddress'.
Mono: Probing 'GetProcAddressA'.
Mono: Probing 'GetProcAddressA'.
Mono: DllImport searching in: '__Internal' ('(null)').
Mono: Searching for 'FreeLibrary'.
Mono: Probing 'FreeLibrary'.
Mono: Probing 'FreeLibrary'.
Mono: Probing 'FreeLibraryA'.
Mono: Probing 'FreeLibraryA'.
Mono: DllImport searching in: '__Internal' ('(null)').
Mono: Searching for 'LoadLibrary'.
Mono: Probing 'LoadLibrary'.
Mono: Probing 'LoadLibrary'.
Mono: Probing 'LoadLibraryA'.
Mono: Probing 'LoadLibraryA'.
With Best Regards, Omky
Upvotes: 0
Views: 397
Reputation: 941327
It is the name of the DLL that's being searched for the function. That would normally be "kernel32.dll" to find LoadLibrary() but Mono also supports the special name "__Internal"
. Which makes it look for the exported function in DLLs that are already loaded. A feature that was originally intended for embedding Mono in an unmanaged program.
It works on Windows, even if Mono is not embedded. Kernel32.dll is always loaded since it is required to get the process running. So the likely [DllImport] directive was:
[DllImport ("__Internal", CharSet = CharSet.Ansi)]
static extern bool LoadLibrary(string path);
Upvotes: 3