loadlibrary

Windows平台LoadLibrary加载动态库搜索路径的问题

天大地大妈咪最大 提交于 2019-12-05 04:56:11
一、背景 在给Adobe Premiere/After Effects等后期制作软件开发第三方插件的时候,我们总希望插件依赖的动态库能够脱离插件的位置,单独存储到另外一个地方。这样一方面可以与其他程序共享这些动态库,还能保证插件安装时非常的清爽。就 Adobe Premiere Pro/After Effects 来说,插件文件是放到 C:\Program Files\Adobe\Common\Plug-ins\7.0\MediaCore ( Windows 平台)的。这个是 PremierePro 和 AfterEffects 的公共插件目录,二者在启动的时候都会尝试去这个位置加载插件。与此同时,我们希望自己开发的插件所依赖的动态库放到另外的位置,另外也希望插件显示链接的动态库能够尽量少。因为如果是显式链接的话,这些插件依赖的动态库必须和插件保存在同一个位置。不然插件找不到这些依赖文件就会加载失败的。当然,我们也可以在环境变量里面增加一条路径,但是这容易污染环境变量,或者与其他的程序库产生冲突。 LoadLibrary 在这个时候就产生作用了。 LoadLibrary 通过将指定路径的动态库加载到当前的调用进程,然后获取其导出的函数就可以正常使用了。对于像第三方插件这样的应用场景, LoadLibrary 可以说是个不错的实现方式。但是正因此也有个弊端

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

偶尔善良 提交于 2019-12-05 04:05:41
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$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(Unknown Source) at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.load0(Unknown Source) at java.lang.System.load(Unknown Source) at com.basistech.util.internal.Native.loadLibrary

How can I execute code directly from memory in delphi?

为君一笑 提交于 2019-12-04 13:18:08
Is it possible to mimic the loadlibrary function? I want to load a library from a BLOB field without first writing it to a temporary file, and I need a solution which is not dependent on specific version of delphi compiler or windows, and does not trigger antivirus software. dzlib contains a ready made object for reading a dll from a resource into memory and using it without ever saving it to disc: This is the main file ... http://sourceforge.net/p/dzlib/code/147/tree/dzlib/trunk/src/u_dzResourceDllLoader.pas .. but it needs other files from the same repository. Yes you can, and you need not

Load two instances of the same DLL in Delphi

蹲街弑〆低调 提交于 2019-12-04 11:21:07
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 (which seems a bit silly) Handle1 := LoadLibrary('mydll.dll'); Handle2 := LoadLibrary('mydll2.dll'); Is there a way to have only one DLL file, but load several instances of it? I don't think that's possible. You'd have to write a .exe which loads the dll. Then you can span

How to prevent a specific DLL from loading into my process

烈酒焚心 提交于 2019-12-04 07:40:45
I think I have researched this pretty thoroughly and I have not found an acceptable answer. First the broad strokes: Windows 8.1, Visual Studio 2013. Although, I don't think these are important. Problem as follows. The application I am writing makes use of A.dll. We use a third-party vendor product (a backup program, but again this is not important) that has installed a Context Menu Handler control under HKEY_CLASSES_ROOT\Directory\shellex\ContextMenuHandlers. Let's say the path to this is c:\Program Files\Vendor\control.dll. Now, the issue is that when my program opens a file chooser dialog

SetDllDirectory LoadLibrary inside a DLL

别等时光非礼了梦想. 提交于 2019-12-04 06:00:35
问题 Can I use C++ SetDllDirectory and LoadLibrary commands inside a C++ DLL to load another DLL? I have tried using them like this: Executable calls the 1st DLL, then 1st DLL loads the 2nd DLL, then 2nd DLL does the calculations... but when I run the executable, I get this error message: This application has requested the Runtime to terminate it in an unusual way. Please contact the applications support team for more information. 2nd DLL works fine when linked directly to Executable! This is the

portable statement to load JNI library from a different directory using relative pathname?

亡梦爱人 提交于 2019-12-04 03:03:15
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 { System.loadLibrary("../some_project/HelloWorld"); } public static native void print(); } The problem is that System.loadLibrary() doesn't support directory separators in the pathname argument. Also, System.load() unfortunately requires an absolute pathname, which not only means I can't specify a relative directory as above (which I would like to do), but it also requires the argument to

Plugin DLLs that depend on other DLLs

为君一笑 提交于 2019-12-04 00:50:06
问题 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, Windows will refuse to load the DLL, since it cannot find the DLLs next to the current process. Are there any good options for helping Windows locate the DLL? To

Delphi interface from DLL

。_饼干妹妹 提交于 2019-12-03 20:41:13
Using Delphi XE. When trying to access a Delphi interface object from a DLL, it fails if I try to do it dynamically versus statically. The interface unit in the dll implements a function to return an instance of the interface. When linked statically, the result is nil when entering the function and everything works. When loading dynamically, the result is non-nil, so when the assignment to result is being done, the IntFCopy code sees it as non-nil and so tries to free it before the assignment, which raises an exception. Any insight would be appreciated. The DLL includes testinterfaceload_u and

Loading Android .so sometimes fails (rarely)

你说的曾经没有我的故事 提交于 2019-12-03 13:54:57
问题 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 so far: The problem is very rare. It happens in a couple of hundred devices out of hundreds of thousands or of installations. Once it happens, it seems like restarting or even reinstallationdoes not solve it. It happens across various brands like