Picking a dll in a particular path while loading a shared library in Windows

I am using MinGW to create a shared library that is dynamically linked and loaded using the LoadLibrary function. My shared library is dependent on a dll that can be found in two different places on the path. These two are different (two different versions) and at the time of loading the library, it picks the wrong dll. How can I explicitly specify which dll to pick? To be more specific thes

在Windows中加载共享库时在特定路径中采用dll

我正在使用MinGW创建一个使用LoadLibrary函数动态链接和加载的共享库。 我的共享库依赖于可以在路径上的两个不同位置找到的dll。 这两个是不同的(两个不同的版本),并在加载库时,它挑选错误的DLL。 我如何明确指定要选择哪个dll? 更具体地说,这些是我正在使用的命令: 汇编 g++ -m64 -O3 -c my_file.cpp -o myfile.o 创建共享库 g++ -m64 -shared myfile.o -o myfile.dll 我已经尝试了许多东西,包括-L选项,但

Is it possible to set fixed DLL search path in VisualStudio application?

This question already has an answer here: Altering DLL search path for static linked DLL 2 answers As mvidelgauz suggested, I've implemented a launcher using winapi. It was my first native winapi project, but it took indeed only halh an hour to implement. I created a default Win32 project in VS2008. In BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) , removed the lines: //ShowW

是否可以在VisualStudio应用程序中设置固定的DLL搜索路径?

这个问题在这里已经有了答案: 更改静态链接DLL 2答案的DLL搜索路径 正如mvidelgauz建议的那样,我已经使用winapi实现了一个启动器。 这是我第一个本地winapi项目,但实际上只花了一个小时才完成。 我在VS2008中创建了一个默认的Win32项目。 在BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) ,删除了这些行: //ShowWindow(hWnd, nCmdShow); //UpdateWindow(hWnd); 然后,而不是他们,我补充说: SetCurrent

Search path for a DLL referenced by a plug

I'm writing a Windows application plug-in (as a DLL) in native C++. Let's call it myplugin.dll . My plug-in references another DLL which we'll call other.dll . My plug-in is installed in the myplugin subdirectory of the application's plugins directory: application.exe plugins myplugin myplugin.dll myplugin.dll links implicitly to other.dll . I cannot delay-load

由插件引用的DLL的搜索路径

我正在用本地C ++编写一个Windows应用程序插件(作为一个DLL)。 我们称之为myplugin.dll 。 我的插件引用另一个DLL,我们将其称为other.dll 。 我的插件安装在应用程序plugins目录的myplugin子目录中: application.exe plugins myplugin myplugin.dll myplugin.dll隐式链接到other.dll 。 我不能延迟加载other.dll因为它暴露了虚拟方法的类,虚拟方法表被视为数据,它们不能从延迟加载的DLL中导入。 我自

A way to load DLL from central repository

We have lot of products and there are some common DLLs across each product's application. Right now we copy each common DLL into each product's bin directory and treat them as private assembly. This unnecessarily increase the msi size of each product and when a problem occurs in a DLL we have to build each product's msi comprising the DLL and deploy it. Is there anyway to instruct

从中央存储库加载DLL的一种方法

我们有很多产品,每个产品的应用程序中都有一些常见的DLL。 现在我们将每个常见的DLL复制到每个产品的bin目录中,并将它们视为私有程序集。 这不必要地增加了每个产品的msi大小,并且当DLL发生问题时,我们必须构建包含DLL的每个产品的msi并部署它。 无论如何要指示产品应用程序使用通用专用目录来加载DLL [使用清单方案..]? [注意:将私有目录添加到PATH env将不会提供解决方案,就好像在SYSTEM目录中存在具有相同名称的D

Get DLL path at runtime

I want to get a dll's directory (or file) path from within its code. (not the program's .exe file path) I've tried a few methods I've found: GetCurrentDir - gets the current directory path. GetModuleFileName - gets the executable's path. So how can i find out in which dll the code is in ? I'm looking for something similar to C#'s Assembly.GetExecutingAssembl

运行时获取DLL路径

我想从代码中得到一个dll的目录(或文件)路径。 (不是程序的.exe文件路径) 我已经尝试了一些我发现的方法: GetCurrentDir - 获取当前目录路径。 GetModuleFileName - 获取可执行文件的路径。 那么我如何才能找出哪些dll代码在? 我正在寻找类似于C#的Assembly.GetExecutingAssembly EXTERN_C IMAGE_DOS_HEADER __ImageBase; .... WCHAR DllPath[MAX_PATH] = {0}; GetModuleFileNameW((HINSTANCE)&__Image

Setup boost and use with Visual Studio 2010 Express

I know that similar questions you can find in web and, particularly in stackoverflow but I still need to write this question because i could no find any page where there is a step by step tutorial how to setup boost library and integrate it with visual studio 2010 express. Even here: How to use Boost in Visual Studio 2010 there are steps (eg 3, 4) that I can't find the menus or so... So pl

设置提升并使用Visual Studio 2010 Express

我知道类似的问题,你可以在网上找到,特别是在stackoverflow,但我仍然需要写这个问题,因为我找不到任何页面,有一步一步的教程如何设置增强库并将其与Visual Studio 2010集成表现。 即使在这里:如何使用Boost在Visual Studio 2010中有步骤(例如3,4),我无法找到菜单或左右... 所以请帮助我能够在Win7上使用visual studio 2010 express。 当我使用“BoostPro Computing”的安装程序安装boost时,遇到了一些链接问题。

How to use Boost in Visual Studio 2010

有关如何在Visual Studio 2010中的空项目中使用Boost库的一步一步的解释是什么? While Nate's answer is pretty good already, I'm going to expand on it more specifically for Visual Studio 2010 as requested, and include information on compiling in the various optional components which requires external libraries. If you are using headers only libraries, then all you need to do is to unarchive

如何在Visual Studio 2010中使用Boost

有关如何在Visual Studio 2010中的空项目中使用Boost库的一步一步的解释是什么? 虽然Nate的答案已经很不错了,但我会根据要求更加专门针对Visual Studio 2010进行扩展,并在各种可选组件中包含需要外部库的信息。 如果您只使用头文件库,那么您只需要解压缩下载并设置环境变量即可。 下面的指令仅为Visual Studio设置环境变量,而不是整个系统。 注意你只需要做一次。 将最新版本的boost(写入时为1.47.0)解压到您选择的

Boost.MPL and type list generation

Background This is for a memory manager in a game engine. I have a freelist implemented, and would like to have a compile-time list if these. (A MPL or Fusion vector, for example). The freelist 's correspond to allocation sizes, and when allocating/deallocating objects of size less than a constant, they will go to the corresponding freelist . In the end, this means small objects global

Boost.MPL和类型列表生成

背景 这是游戏引擎中的内存管理器。 我有一个freelist实现,并希望有一个编译时间列表,如果这些。 (例如MPL或Fusion矢量)。 freelist对应于分配大小,当分配/取消分配大小小于常量的对象时,它们将转到相应的freelist 。 最后,这意味着全球的小型对象具有分摊的恒定时间分配和恒定的时间重新分配。 (好极了。) 问题 问题在于生成我需要的类型,所以我最终可能会使用Fusion来实例化这些类型。 正在使用的类型

Trying to know why the OpenMP code does not parallelise

I just started learning how to use OpenMP. I am trying to figure out why the following code does not run in parallel with Visual Studio 2008. It compiles and runs fine. However it uses only one core on my quad core machine. This is part of the code that I am trying to port to a MATLAB mex function. Any pointer is appreciated. #pragma omp parallel for default(shared) private(dz, t, v, ts_coun

试图了解为什么OpenMP代码不平行

我刚开始学习如何使用OpenMP。 我想弄清楚为什么下面的代码不能与Visual Studio 2008并行运行。它编译并运行正常。 但是它在我的四核机器上只使用了一个核心。 这是我尝试移植到MATLAB mex函数的代码的一部分。 任何指针赞赏。 #pragma omp parallel for default(shared) private(dz, t, v, ts_count) reduction(+: sum_v) for(t = 0; t<T; t++) { dz = aRNG->randn(); v += mrdt* (tv - v) + vv_v_s

How should I interpreter these VTune results?

I'm trying to parallelyzing this code using OpenMP. OpenCV (built using IPP for best efficiency) is used as external library. I'm having problems unbalanced CPU usage in parallel for s, but it seems that there is no load imbalance. As you will see, this could be because of KMP_BLOCKTIME=0 , but this could be necessary because of external libraries (IPP, TBB, OpenMP, OpenCV). In the r

我应该如何解释这些VTune结果?

我正在尝试使用OpenMP来并行处理此代码。 OpenCV(使用IPP构建以获得最佳效率)用作外部库。 我遇到了parallel for CPU不平衡问题,但似乎没有负载不平衡。 正如您将看到的,这可能是因为KMP_BLOCKTIME=0 ,但由于外部库(IPP,TBB,OpenMP,OpenCV),这可能是必需的。 在其余的问题中,您可以找到更多可以下载的详细信息和数据。 这些是我的VTune结果的Google Drive链接: c755823基本KMP_BLOCKTIME = 0 30次运行:环