dynamic-library

Allowing dynamically loaded libraries in C to “publish” functions for use

試著忘記壹切 提交于 2019-12-25 03:41:12
问题 I'm writing a program in C which allows users to implement custom "functions" to be run by an interpreter of sorts. I also want to allow users to write these custom functions in plain C, and then be loaded in dynamically. In order to do this, I created two structs, one for interpreted functions, and one for native ones. Here's a simplified example: struct func_lang { bool is_native; char* identifier; // various other properties } typedef void (*func_native_ptr)(int); struct func_native { bool

How to manually include a dynamic library in an iOS APP

人走茶凉 提交于 2019-12-24 00:04:39
问题 I have an iOS app (not made with xcode) and I need to include in it a dynamic library. I have this library on my computer: \webrtc \WebRTC.framework \Headers \*.h \Modules \module.modulemap \WebRTC \Info.plist and I deploy those files inside my app like this : ALLiveVideoChatClient.app \Frameworks \WebRTC.framework \Headers \*.h \Modules \module.modulemap \WebRTC \Info.plist when I do otool -L ALLiveVideoChatClient.app/ALLiveVideoChatClient it's return me: @rpath/WebRTC.framework/WebRTC

Linux C/C++ allocate/deallocate memory in dynamic library

主宰稳场 提交于 2019-12-23 20:31:30
问题 I have to split my application into several logical modules. mainapp : module1.so module2.so module3.so and so on Where each module is an *.so library, which will be loaded during runtime. Each module shares the same interface and will return some array of data. For example: int *ptr = module1->getIntData(); Is it OK, to free/delete this memory on mainapp side? int *ptr = module1->getIntData(); delete ptr; //(or free(ptr)) What about a malloc/free implementations. Is it possible, that library

Is the “C++ dlopen mini HOWTO” the recommended technique for compiling dynamically loaded C++ plugin libraries?

纵然是瞬间 提交于 2019-12-23 12:58:36
问题 By Plugin. We mean a library that is loaded vi dlopen() and its symbols resolved via dlsym() (not a standard shard library that is dynamically loaded by the runtime system). Referring to http://www.isotton.com/howtos/C++-dlopen-mini-HOWTO/. The document was last updated in 2006. It recommends the use of extern "C" to prevent mangling of function names, so that dlsym can find its functions with relative ease. Is this still relevant for dynamic libraries? In my particular case, I am trying to

undefined reference to symbol even when nm indicates that this symbol is present in the shared library 2

本秂侑毒 提交于 2019-12-23 06:04:07
问题 I found same question here but the answer doesn't help me. I'm writing test app to use nglib library. But when I try to compile it I get undefined references: $ g++ test1.cpp -L. -lnglib test1.cpp: In function ‘int main()’: /tmp/cchcKZfx.o:test1.cpp:function main: error: undefined reference to 'Ng_Init()' /tmp/cchcKZfx.o:test1.cpp:function main: error: undefined reference to 'Ng_NewMesh()' ... /tmp/cchcKZfx.o:test1.cpp:function main: error: undefined reference to 'Ng_Exit()' collect2: ld

undefined reference to symbol even when nm indicates that this symbol is present in the shared library 2

蓝咒 提交于 2019-12-23 06:03:58
问题 I found same question here but the answer doesn't help me. I'm writing test app to use nglib library. But when I try to compile it I get undefined references: $ g++ test1.cpp -L. -lnglib test1.cpp: In function ‘int main()’: /tmp/cchcKZfx.o:test1.cpp:function main: error: undefined reference to 'Ng_Init()' /tmp/cchcKZfx.o:test1.cpp:function main: error: undefined reference to 'Ng_NewMesh()' ... /tmp/cchcKZfx.o:test1.cpp:function main: error: undefined reference to 'Ng_Exit()' collect2: ld

Compiling Lua - create .so files?

和自甴很熟 提交于 2019-12-21 12:09:18
问题 I am compiling Lua 5.2.3 on Centos 6.5, and the compilation / install works fine. However, I also need the development libraries for another program to compile. I would usually install these by doing this : yum install lua-devel Problem is that installs the Lua 5.1 shared libraries, not the 5.2.3 ones. I could just run with Lua 5.1 from the Centos repo, but if it's a simple-ish thing (for someone who knows) to make the latest version work then I'd be grateful for someone showing me the way.

Meaning of library dl in gcc

梦想与她 提交于 2019-12-21 03:23:13
问题 I'm checking a makefile, and see that the libraries used are: LIBS = -lcppunit -ldl lcppunit is the unit testing library. What is ldl then? 回答1: libdl is the dynamic linking library. 回答2: This is the interface to the dynamic loader, which provides a client program with ability to do things such as explicitly load other libraries, lookup symbols within, etc. Most programs do not need to do such things explicitly, since the linker does what is needed to enable ordinary usage of shared libraries

How to debug dylib with Xcode?

给你一囗甜甜゛ 提交于 2019-12-20 14:25:47
问题 I have a Xcode project for library arith. I could build it with debug configuration, and I need to debug it. How can I do that? The ideal method would be to set up a test code to build an execution in a project file, and then set a breakpoint in a source code in arith library. However, it seems that Xcode arith project doesn't allow to add another use_arith project that uses the arith library. What method people use to debug a dynamic library in Xcode? ADDED I googled and found some ways to

dlopen() error image not found

為{幸葍}努か 提交于 2019-12-19 18:11:28
问题 I have software that first loads a .dylib lets call libFirst.dylib using the following command: void* handle = dlopen(path.c_str(), RTLD_LAZY | RTLD_GLOBAL); Later on inside a function from the loaded libFirst.dylib I attempt to load another .dylib using the same command but for libSecond.dylib, the loading of this shared library gives me the following warnings in my Xcode console: error warning: Ignored unknown object module at 0x129310 with type 0x8a8399 dlerror: dlopen(/path/libSecond