Questions tagged [loadlibrary]
558 questions
55
votes
7 answers
DLL Load Library - Error Code 126
I'm using the 'LoadLibrary' from the Windows API, when I run the application, it throws me an error code 126. I read that it may be caused by dependencies, I checked what's wrong with some applications like Dependency Walker, but everything was…

Spamdark
- 1,341
- 2
- 19
- 38
53
votes
3 answers
Load 32-bit DLL library in 64-bit application
Is there a way to load a 32-bit DLL library (something with the same usage as LoadLibrary) I would like to use that function along with GetProcAddress.
I looked at WOW, but it does not seem to offer the functionality. The functionality should exist,…

adk
- 4,479
- 9
- 36
- 38
32
votes
9 answers
C/C++ How Does Dynamic Linking Work On Different Platforms?
How does dynamic linking work generally?
On Windows (LoadLibrary), you need a .dll to call at runtime, but at link time, you need to provide a corresponding .lib file or the program won't link... What does the .lib file contain? A description of…

Charlie
- 4,197
- 5
- 42
- 59
27
votes
3 answers
Does LoadLibrary create distinct instances?
If I use the Win32 API LoadLibrary to load the same DLL 3 times in a row it should return 3 distinct handles and the functions in each library should all have different addresses correct? (Or does it do something "smart" and detect if the dll has…

User48765902
- 361
- 1
- 4
- 7
27
votes
9 answers
LoadLibrary() error code 127
I'm having trouble with LoadLibrary() and getting an error that doesn't make sense to me:
::SetLastError(0);
m_hDll = ::LoadLibrary(szName);
if (m_hDll == NULL) // Failure to load the DLL.
{
DWORD err = GetLastError();
}
The…

Adam Tegen
- 25,378
- 33
- 125
- 153
23
votes
3 answers
GetProcAddress function in C++
Hello guys: I've loaded my DLL in my project but whenever I use the GetProcAddress function. it returns NULL! what should I do?
I use this function ( double GetNumber(double x) ) in "MYDLL.dll"
Here is a code which I used:
typedef double…

Alireza
- 1,018
- 1
- 8
- 23
16
votes
2 answers
My dll code works from an exe file, but fails to load from Java loadLibrary
I have created a C++ module to build into a shared library file and then call it from Java using JNI.
I have 2 environments, Windows and Unix and I have a C++ executable program and a Java program that I just recompile for each environment.
When I…

Logan
- 2,369
- 19
- 20
14
votes
3 answers
Load the same dll multiple times
I want to load the same dll e.g. Lib.dll multiple times!
-> need creating a new process (CreateProcess function) for every LoadLibrary!
Anyone have an example or some hints?!
Thx and greets

leon22
- 5,280
- 19
- 62
- 100
11
votes
5 answers
DllImport or LoadLibrary for best performance
I have external .DLL file with fast assembler code inside. What is the best way to call functions in this .DLL file to get best performance?

apocalypse
- 5,764
- 9
- 47
- 95
10
votes
4 answers
Java JNI call to load library
Does it impact memory if I have two Java classes that have native calls to compiled C code and I call both those classes in another class? For instance I have Class A and Class B with both calls to native functions. They are setup like…

JPM
- 9,077
- 13
- 78
- 137
10
votes
4 answers
LoadLibrary taking a LPCTSTR
I want to develop a plugin system using LoadLibrary.
My problem is: I want my function to take a const char* and LoadLibrary takes a LPCTSTR.
I had the bright idea to do (LPCSTR)path which kept giving me a module not found error.
Current code is…

Ben
- 2,867
- 2
- 22
- 32
10
votes
6 answers
How do I use a COM DLL with LoadLibrary in C++
First, COM is like black magic for me. But I need to use COM dll in one project I'm working on.
So, I have a DLL I am developing and I need some functionalities that are available in a separate COM DLL. When I look to the COM DLL with Depends.exe I…

Symbiosoft
- 4,681
- 6
- 32
- 46
10
votes
7 answers
Is there a better way to load a dll in C++?
Right now I do something like this and it seems messy if I end having a lot of functions I want to reference in my DLL. Is there a better and cleaner way of accessing the functions without having to create a typedef for each function definition so…

Brian T Hannan
- 3,925
- 18
- 56
- 96
10
votes
2 answers
portable statement to load JNI library from a different directory using relative pathname?
Is there a platform-independent Java statement to load a native library from a different directory than the Java source code is in? I would like to use something like this:
public class HelloWorld {
static {
…

jvm_update
- 265
- 2
- 9
9
votes
2 answers
Calling LoadLibrary on a 64-bit dll from a 32-bit process
I have a 32-bit exe that needs to dynamically load a 64-bit dll when it detects that the operating system is 64-bit. Is this possible through LoadLibrary? If not, is there another way to accomplish the same goal?

Spilly
- 1,069
- 2
- 9
- 16