dll

What happens to the global variables in shared library when dlclose is called on it?

一曲冷凌霜 提交于 2020-01-01 06:14:06
问题 If a shared library (or a DLL) is being used through dlopen and dlclose mechanism and if the shared library created has some global variables whose memory comes from the heap, then what will happen to those variables and the memory when dlclose is called? If in the same process, dlopen is called again, what will be the behaviour? 回答1: If dlclose reduces the reference count to zero and the library is actually unloaded, any future reloading of the library should reset all variables with static

What happens to the global variables in shared library when dlclose is called on it?

混江龙づ霸主 提交于 2020-01-01 06:13:15
问题 If a shared library (or a DLL) is being used through dlopen and dlclose mechanism and if the shared library created has some global variables whose memory comes from the heap, then what will happen to those variables and the memory when dlclose is called? If in the same process, dlopen is called again, what will be the behaviour? 回答1: If dlclose reduces the reference count to zero and the library is actually unloaded, any future reloading of the library should reset all variables with static

Update application's libraries (DLLs) during runtime?

浪子不回头ぞ 提交于 2020-01-01 06:10:28
问题 Is there a way to update DLL while application is running in C#? For example, if there is DLL with a function that looks like this: void write() { Console.WriteLine("LALALA"); } And it is called in a thread with 1 second sleep between calls. Now, I wrote the new version: void write() { Console.WriteLine("LA LA LA\n"); } Can I update old DLL with this new one during runtime? It is important that my APP is up and running all the time, no meter what... but I guess that updating libraries is an

How can I manage building library projects that produce both a static lib and a dll?

ε祈祈猫儿з 提交于 2020-01-01 05:25:06
问题 I've got a large visual studio solution with ~50 projects. There are configurations for StaticDebug, StaticRelease, Debug and Release. Some libraries are needed in both dll and static lib form. To get them, we rebuild the solution with a different configuration. The Configuration Manager window is used to setup which projects need to build in which flavours, static lib, dynamic dll or both. This can by quite tricky to manage and it's a bit annoying to have to build the solution multiple times

How to call a function defined in my exe inside my DLL?

青春壹個敷衍的年華 提交于 2020-01-01 04:55:21
问题 I have some general purpose functions defines in my exe file like Log(char* str) . This function takes a string as an input from the caller and writes it to the logfile defined for that application. Now I want to write DLL code which will include a function to upload a file to a server. The objective is to import the upload function from the DLL into the exe and use it. However, if any error is encountered, then the upload function must call the Log(char* str) function to write the error into

Adding same “*.dll” reference to multiple projects in the same Solution

只愿长相守 提交于 2020-01-01 04:34:48
问题 I have a Visual Studio 2008 .NET C++/CLI Solution. My Solution consist of many sub projects. I define a custom buid directory for each project call it Output. MySoultion MyFirstProject (*.exe) MySecondPrject (*.dll) ... MyNthProject (*.dll) Each of the sub project use Log4.net.So I create a directory (called LogBinary) and put log4.net dll in that folder.Then to use log4net i add this dll as a reference to each of my project... But when i try to compile my main project (*.exe) i got tons of

Changing C# .dll references from absolute to relative

寵の児 提交于 2020-01-01 04:13:25
问题 I have compiled my project and some of my project's added .dlls have absolute references. When I try to run my project on another machine, it looks for the .dlls from the original project path. How can I make the project look for the .dlls using a relative path? 回答1: Edit the .csproj file and change the <HintPath> elements from absolute paths to relative paths. 回答2: You may also write your handler for resolving assemblies. In the simplest form it may look like this: AppDomain.CurrentDomain

Issues passing data from DLL to Application

喜夏-厌秋 提交于 2020-01-01 03:30:14
问题 I'm a bit puzzled as to how Pointers should be properly used in my scenario. I have a DLL with some embedded resources in it. I expose a function in this DLL which passes binary data of one of those resources back to its calling app. In this case, I've embedded a JPG image file. My DLL does properly load the file into a resource stream. However from there, the passing it back to the app gets messy. Here's my DLL's code (with a JPG loaded and named SOMERESOURCE ): library ResDLL; {$R *.dres}

How to load views from a Class Library project?

為{幸葍}努か 提交于 2020-01-01 02:44:00
问题 I tried to create a VirtualPathProvider and set the view as an embedded resource. class AssemblyResourceVirtualFile : VirtualFile { string path; public AssemblyResourceVirtualFile(string virtualPath) : base(virtualPath) { path = VirtualPathUtility.ToAppRelative(virtualPath); } public override System.IO.Stream Open() { string[] parts = path.Split('/'); string assemblyName = parts[2]; string resourceName = parts[3]; assemblyName = Path.Combine(HttpRuntime.BinDirectory, assemblyName); var

Possible to use a .dll on Linux

耗尽温柔 提交于 2020-01-01 02:10:13
问题 Question: Is it possible to compile a program on linux using a .dll file? Where this is going: This .dll will be used to write a php extension to some proprietary software from a third party. Background and Research: I have been given a library called proprietary.lib . I was curious, as I have never seen the .lib extension before, so I typed: file proprietary.lib The output was: proprietary.lib: current ar archive I did some research and found that ar is more-or-less tar (and in fact, I guess