loadlibrary

Hooking LoadLibrary API call

I want to load a different version of a DLL than is present in the working directory of the application. For this I need to hook the LoadLibrary call so that when the application makes a call to load the DLL I can substitute it with the newer version of that DLL transparently. I tried using NCodeHook and have the following code in my DLL...

LoadLibrary on OCX file fails in Windows 7 x64

Hi, I need to open a html help file from within a legacy windows application written in old version of C++ Builder. HtmlHelp is loaded via HtmlHelp.ocx, which I am loading via LoadLibrary. This has worked fine for years, but it does not work anymore in Windows 7 x64. It might also fail under Windows7 x86, but I don't have any computer...

LoadLibrary Static/Globals and Threads

Say I have a DLL that has the following static/global: ClassA Object; Along with the implementation of ClassA, it also contains a 'regular' ClassB, which will not work properly if ClassA has not been constructed yet (which is why I've made ClassA is a static/global). In Windows, I believe that the DLL loader will load this DLL on the...

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 that it will compile and load the function properly. I mean the function definitions are al...

Calling any dll function based on variable arguments

I have the following items in a structure - Dll name (absolute/relative path) - Function name in the dll - number of parameters - Array of parameter types and values With these information, I need to load the dll and call the function. To load the dll - I would use loadlibrary To get the address of the function - I would use GetProcAdd...

LoadLibrary of unmanaged dll returns IntPtr.Zero in ASP.NET application.

I am trying to call LoadLibrary and load Delphi dll in ASP.NET application. On my production machine everything works fine (using VS integrated server), but when I place it on destination server, LoadLibrary returns IntPtr.Zero. File.Exists(libraryName) returns true. What can be the problem? ...

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 see methods like DllGetClassObject() and other functions but none of the functions I'm i...

Plugin DLLs that depend on other DLLs

I am writing a DLL to plug into another (3rd party) application. The DLL will need to depend on another set of DLLs (for license reasons I cannot link statically). I would like my DLL to be "xcopy-deployable" to any directory. I would also like not to require adding this directory to the path. If I just build the DLL the usual way, Win...

Load 32bit DLL library in 64bit application

Is there a way to load a 32bit 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, since tools like DependencyWalker are able to read the symbols of a 32bit dll even though...

Redistributable compiler - DLLs for MS Visual Studio

I'm making a programming learning game for my senior project and I'm looking for a compiler that can compile a DLL that can then be dynamically loaded into a Visual Studio 2008 C++ application. The important idea here is that the compiler is redistributable. If VS was redistributable I'd be using that. So far I'm had some success using...

Java web application cannot use native library (.so)

Hi all, Technical summary: I'm developing a Java web service deployed on GlassFish v3, running on CentOS 5. My web service uses functionality provided by a native library (.so) . The native library works fine, however I am not having much luck in configuring the environment correctly to load the native library yet not be affected by we...

LoadLibrary() fails to load DLL with manifest and private assembly

I am working on a Windows application (EXE) that uses multiple DLLs. Development is in VCExpress 2005 (VC 8.0), using C only. Some of these DLLs are plug-ins/add-ons/extensions that are dynamically loaded using [LoadLibrary](http://msdn.microsoft.com/en-us/library/ms684175(VS.85).aspx) according to a configuration file read by the EXE....

Function pointers and unknown number of arguments in C++

I came across the following weird chunk of code.Imagine you have the following typedef: typedef int (*MyFunctionPointer)(int param_1, int param_2); And then , in a function , we are trying to run a function from a DLL in the following way: LPCWSTR DllFileName; //Path to the dll stored here LPCSTR _FunctionName; // (mangled) name...

Issue while loading a dll library file... java.lang.UnsatisfiedLinkError: Can't load library

Hi, While loading a dll file, I am getting the following exception: Exception in thread "main" java.lang.UnsatisfiedLinkError: D:\Transliteration\rlpnc-3.1.0-sdk-ia32-w32-msvc80\rlp\bin\ia32-w32-msvc80\btrntjni.dll: The system cannot find message text for message number 0x%1 in the message file for %2 at java.lang.ClassLoader$Na...

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? ...

Trying to load a DLL with LoadLibrary and get R6034 "An application has made an attempt to load the C runtime library incorrectly"

I'm writing a wrapper program that loads Winamp input plugins. I've got it working well so far with quite a few plugins, but for some others, I get an error message at runtime when I attempt to call LoadLibrary on the plugin's DLL. (It seems to happen mostly with plugins that were included with Winamp.) A dialog appears and gives me t...

Delphi LoadLibrary Failing to find DLL other directory - any good options?

Two Delphi programs need to load foo.dll, which contains some code that injects a client-auth certificate into a SOAP request. foo.dll resides in c:\fooapp\foo.dll and is normally loaded by c:\fooapp\foo.exe. That works fine. The other program needs the same functionality, but it resides in c:\program files\unwantedstepchild\sadapp.ex...

Loading a dll from a dll ?

What's the best way for loading a dll from a dll ? My problem is I can't load a dll on process_attach, and I cannot load the dll from the main program, because I don't control the main program source. And therefore I cannot call a non-dllmain function, too. ...

Load two instances of the same DLL in Delphi

Here's my problem: I would like to create two separate instances of the same DLL. The following doesn't work because Handle1 and Handle2 will get the same address Handle1 := LoadLibrary('mydll.dll'); Handle2 := LoadLibrary('mydll.dll'); The following works, but I have to make a copy of the DLL and rename it to something else (wh...

What is the "Cannot set allocations" error, who emits it and what can I do about it?

We've been plagued for several years by occasional reports from customers about a non-descript error message "Cannot set allocations" that appears on startup of our app. We have never been able to reproduce the problem in our own test environments so far. I have now run out of ideas for attempting to track this down. Here's a collection ...