Questions tagged [loadlibrary]
558 questions
5
votes
2 answers
What exactly means ERROR_INVALID_ORDINAL?
The LoadLibrary function is returning to me the error code 182. From MSDN:
ERROR_INVALID_ORDINAL: "The operating system cannot run %1"
Does anyone have a better description of what this error is?

korbes
- 1,273
- 1
- 12
- 18
5
votes
0 answers
Loading Android .so sometimes fails (rarely)
We have a strange problem with our Android app. In Fabric we have a very infrequent crash. It is a standard UnsatisfiedLinkError meaning that in the static initializer of the Java class, the .so library fails to load. This is what we have found out…

user1816142
- 1,199
- 2
- 9
- 16
5
votes
5 answers
GetProcAddress() failing, error 127
Here's my DLL code:
#include
#include
int sysLol(char *arg);
int sysLol(char *arg)
{
std::cout<
#include
#include…

Moon
- 329
- 2
- 3
- 20
5
votes
2 answers
C++ Loadlibrary() error 3765269347
I have got this Loadlibraty() error 3765269347 bothering me. I am implementing a C++ console application, built as x64, to load a x64 native C++ dll. Following is the code in the C++ console application to load the dll:
bool InitDll()
{
…

Nick X Tsui
- 2,737
- 6
- 39
- 73
5
votes
1 answer
What is the purpose of thunk file generated by matlab?
When calling external C library (DLL) from matlab, it seems that matlab will first try to generate a thunk file named as filename_thunk_pcwinXX.dll (where XX is either 32 or 64 depend on the OS) in a temp directory.
In matlab docs, it mentions that…

user0002128
- 2,785
- 2
- 23
- 40
5
votes
2 answers
LoadLibrary with Absolute Path returns Incorrect HMODULE with No Error
I have some code which is trying to load a Dll.
I have encountered an odd 'error' with this. When trying to load the dll from an absolute path, I get a Non-Null HMODULE that gives no windows error codes on a GetLastError call (i.e. GetLastError…

funseiki
- 9,167
- 9
- 36
- 59
5
votes
1 answer
Address range of a dynamically loaded library under Windows
I have a working program that loads plugins with LoadLibrary.
New requirement: at some point in the code, I'm given a pointer, and I need to test whether this pointer points into the code or static data of a plugin.
bool is_pointer_into_plugin(void…

Gilles 'SO- stop being evil'
- 104,111
- 38
- 209
- 254
4
votes
2 answers
embed DLL in MFC C++ EXE?
Is it possible to embed an external CLI/C++ DLL into a MFC EXE as a embedded resource or something like that? My application currently connects to DLL sitting right beside it that has some basic functions like connect to database, pull information…

Landin Martens
- 3,283
- 12
- 43
- 61
4
votes
4 answers
Hook LoadLibrary call from managed code
We would like to hook calls to LoadLibrary in order to download assemblies that are not found. We have a handler for ResolveAssembly that handles the managed assemblies, but we also need to handle unmanaged assemblies.
We have attempted to hook…

Todd Kobus
- 409
- 5
- 15
4
votes
6 answers
LoadLibrary fails when including a specific file during DLL build
I'm getting really strange behavior in one of the DLLs of my C++ app. It works and loads fine until I include a single file using #include in the main file of the DLL. I then get this error message:
Loading components from…
Jaco
4
votes
1 answer
Should FreeLibrary be called at the end of the program?
I haven't found this in the documentation: if I need a DLL handler until the end of the program, should I still call FreeLibrary before my caller program ends, or it's not required?

Bruice
- 543
- 3
- 11
4
votes
0 answers
DLL is still locked after calling FreeLibrary
My architecture is as follows:
Program.exe links to 1.dll
1.dll attempts to load DLL files in some directory (i.e. 2.dll) via LoadLibrary
1.dll attempts to find a function called "setup" via GetProcAddress("setup")
1.dll does some work and may…

user_4685247
- 2,878
- 2
- 17
- 43
4
votes
2 answers
C++/CLI: Use LoadLibrary + GetProcAddress with an exe
Up until now, I had some sort of plugin mechanism in which I loaded dlls using LoadLibrary and GetProcAddress to create a concrete object and return a common interface. This worked fine until I decided that one of the dlls should be an…

dario_ramos
- 7,118
- 9
- 61
- 108
4
votes
1 answer
LoadLibraryExW Fails to Load User32.dll
When trying to load C:\Windows\System32\user32.dll via LoadLibraryExW, it fails with the last error of ERROR_INVALID_IMAGE_HASH.
Here is how it is loaded:
HMODULE User32Lib = LoadLibraryExW(L"C:\\Windows\\System32\\user32.dll", NULL,…

Anthony Smith
- 83
- 8
4
votes
2 answers
Get reason that LoadLibrary cannot load DLL
On Linux and Mac, when using dlopen() to load a shared library that links to another library, if linking fails because of a missing symbol, you can get the name of the missing symbol with dlerror(). It says something like
dlopen failed: cannot…

Vortico
- 2,610
- 2
- 32
- 49