shared-libraries

Load a DLL More Than Once?

牧云@^-^@ 提交于 2019-12-04 03:06:32
I'm using the LoadLibrary function to load a DLL in Windows. My question is this: If I call this method more than once for the same DLL, do I get handles to different instances of the DLL, or will they all refer to the same instance? Additionally, how does this behaviour correlate to Linux SO files, is it the same or completely different, and what assumptions can I make in this regard? Thanks. The MSDN documentation states: The system maintains a per-process reference count on all loaded modules. Calling LoadLibrary increments the reference count. Calling the FreeLibrary or

What is the deal with undefined symbols in a shared library or dylib?

独自空忆成欢 提交于 2019-12-04 02:59:30
问题 I have a Makefile for linux that I am porting over to Darwin. The makefile takes a bunch of .o files and links them together into a .so shared object. Okay, so I figured (am I wrong about this?) that the best analog for this in Darwin is the dylib. So I changed the -shared flag to -dynamiclib. Now the code that I am linking together into the dylib depends on lots of external libraries. When I try to build the dylib, I get errors saying there are undefined references. But the Linux Makefile

Angular 6 private methods

百般思念 提交于 2019-12-04 02:43:32
We are upgrading to Angular 6 from 5. We have a shared library that we are getting build errors. Being a Java shop, we got in the habit of marking our component methods and attributes private. In Angular 6 when building our library (after converting and using the new library CLI capability), we get: Property 'getCurrentYear' is private and only accessible within class. In effect any attribute or method used in a template html cannot be marked private anymore on the component class. Of course we can fix this by removing the 'private' modifier. This was not the case in angular 5 when we produced

How to initialize Qt resources from a shared library?

放肆的年华 提交于 2019-12-04 02:35:49
I can not figure out how to initialize Qt resources declared in and used by a shared library under Red Hat Enterprise Linux 5.2. I added a Qt resource file to my shared library, added a prefix named "resource", and added a file "files/styleSheet.xsl". The resource file is named "resources.qrc". QFile::exists returns false? MySharedLib::MySharedLib() { // I think Q_INIT_RESOURCE basically expands to this: // The resource file is named "resources.qrc" extern int qInitResources_resources(); qInitResources_resources(); QString resourcePath = ":/resource/files/styleSheet.xsl"; if( false == QFile:

Can I determine which compiler/linker flags where used to create a binary-only shared library?

被刻印的时光 ゝ 提交于 2019-12-04 02:13:21
I am wondering if there is a way to find out which g++ compiler/linker flags where used in creating a binary-only library. For example there might be a 3rd party shared library (only .h/.so files are there). So I think it would be a good idea to use the same g++ flags when compiling and linking my own application (that is using the binary-only 3rd party library). Specifically I am asking for compiler flags like -fno-inline -pthreads -mtune=arch -O2 and also it would be of interest which linker flags have been used: -fpic or -fPIC -fexceptions -pthreads and so on. There is no systematic way of

Use 32bit shared library from 64bit application?

为君一笑 提交于 2019-12-04 02:13:08
问题 I have created a simple linux 32bit shared library(.so) for my rendering wrappers but i've hit a wall when i figured that i can only use them through 32bit applications.................... This is how my code looks like: RendIFace.h: //Basic renderer interface struct Renderer { int type; ...other things }; GLRend.c: #include "RendIFace.h" struct Renderer* GLRendererCreate(int width,int height,int bytesPerPixel) { struct Renderer* rend = (struct Renderer*)malloc(sizeof(Renderer)); rend->type =

Tracing calls to a shared library

末鹿安然 提交于 2019-12-04 01:57:02
I am developing a program under Linux. For debugging purposes I want to trace all calls from my program to a certain (preferably shared) library. (I do not want to trace calls happening inside the library.) For syscalls there is strace. Is there any instrument to trace calls to a shared library? The tool you are looking for is called ltrace . It allows to trace any call from the program to all (or a set of given) libraries. For example, the following call will list any call to an external function loaded by a shared library: $> ltrace ls / __libc_start_main(0x4028c0, 2, 0x7fff1f4e72d8,

Debug C-library from Python (ctypes)

一个人想着一个人 提交于 2019-12-04 01:16:45
I have a Python-program that uses ctypes and a C-shared library (dll-file). As an IDE, I am using Eclipse, where both projects will be developed (the C-shared library and the python program that uses it). My idea is: when I start the Python-program in Debug-mode, can I somehow debug the shared library, which is written in C, too? Meaning: Can I set breakpoints and when the Python-program reaches that breakpoint in the shared library, executing stops and I can change variable values etc.? Thanks for the help. Actually, it is a fairly simple thing to do using the CDT and PyDev environments in

Loading Ada shared objects in Perl with DynaLoader.pm

不打扰是莪最后的温柔 提交于 2019-12-04 01:16:23
Long time listener, first time caller. I'm aware this is a somewhat obscure question, and don't expect too much. :-) I have the following Ada files: greeter.ads package Greeter is procedure Hello; end Greeter; greeter.adb with Ada.Text_IO; use Ada.Text_IO; package body Greeter is procedure Hello is begin Put_Line ("Hello, world!"); end Hello; end Greeter; And compile them into a shared object like this: gnatmake -z -fPIC greeter.adb gcc -shared -o libgreeter.so greeter.o This compiles fine. nm shows the following symbols: $ nm -D libgreeter.so w _Jv_RegisterClasses 0000000000201028 A __bss

Why do some DLL files need an additional .lib file for linking?

Deadly 提交于 2019-12-04 00:53:26
I have a question about library linking and .lib files... this is the context: OS = Windows IDE = QT I have created a DLL: MyLib.dll. To use that library in my QT project, I only have to include an include path, a link to the library and use the header files: LIBS += "C:\myPath\MyLib.dll" INCLUDEPATH += "C:\myPath" HEADERS += \ ../myPath/MyLib_global.h \ ../myPath/mylib.h I am using a third party dll in my project: third.dll If I do the same as in the above example, it does not work: LIBS += "C:\myPath\third.dll" The third party DLL comes with a .lib file "third.lib", which I apparently need