dynamic-loading

Getting undefined symbol error while dynamic loading of shared library

纵然是瞬间 提交于 2019-12-03 15:01:17
问题 I am getting undefined symbol error while loading library dynamically. Here is my code snippet that generates this error : int main () { void *lib_handle = NULL; MyClass* (*create)(); void (*destroy)(MyClass*); char *error; lib_handle = dlopen ("./libshared.so", RTLD_LAZY); if (lib_handle == NULL) { fprintf(stderr, "%s\n", dlerror()); exit(1); } create = (MyClass* (*)()) dlsym(lib_handle, "create_object"); if ((error = dlerror()) != NULL) { fprintf(stderr, "%s\n", error); exit(1); } destroy =

How to dynamically load a C# dll from a C++ DLL

限于喜欢 提交于 2019-12-03 13:43:47
I have a C++ application. This supports users' C++ plugin DLL's, it will dynamically load these DLL's and then be able to create and use the user's types dynamically. These user types derive from base types and interfaces defined in the main application's core library, so I hold user's objects as pointers to the base class and call the user's virtual functions to make their magic happen. Now I want to extend the plugin DLL's to allow managed DLL's (I care about C# mostly). I want all of the same magic to happen in C# plugin DLL's. How can I dynamically load these dll's, some how I think win32

Dynamically loadable and unloadable application modules in Java - how?

非 Y 不嫁゛ 提交于 2019-12-03 08:32:33
I'm writing a server application which makes use of external modules. I would like to make them to be upgradeable without requiring server restart. How do I do that? I've found OSGi but it looks very complicated and big for my task. Simple *.jar files are ok, but once they are loaded, I suppose, I cannot unload them from VM and replace with another version on-the-fly. What approach can you suggest? It seems like OSGi is exactly what you're asking for. It can be complex, but there are ways to deal with that. Some of the complexity can be mitigated by using SpringDM or something similar to

Dynamically loading classes (with custom behavior) from different assemblies?

拥有回忆 提交于 2019-12-03 08:24:12
We are building an app for few customers, each has its own requirements along with the similar ones. We also want to keep all the code in the same app, not branch it, and the IFs is not good choice since it will be all over places. I plan having the base classes for all. Then each customer will have its own class in which the override methods will do special logic. How can we load the assemblies when compiling instead of doing this public class BaseClass { public string getEventId() } public class ClassForJohn:BaseClass { [override] public string getEventId() } public class ClassForAdam

jQuery getScript() vs document.createElement('script')

三世轮回 提交于 2019-12-03 05:56:58
Assuming that both of these approaches load the script properly, and that I wait the appropriate amount of time before using the script (and/or use a callback), what are the major differences between these approaches. Note: I understand the first uses jQuery (which is a larger download etc.). What I'm really interested in is the after affects of these approaches. Does one place the script in a different scope than the other? Etc. jQuery: function loadScript() { $.getScript('http://www.mydomain/myscript.js'); } Appending to body: function loadScript() { var script= document.createElement(

Load a script dynamically within the <head> element

橙三吉。 提交于 2019-12-02 22:34:09
问题 Okay so I'm trying to load a backup .js file synchronously in the event of a script dependency being unavailable, and everything seems to be working fine except for the fact that said script doesn't actually load, even though the element itself with the src is created: [etc] <head> <script id = 'self'> if (typeof jQuery === 'undefined') { function insertAfter(referenceNode, el) { referenceNode.parentNode.insertBefore(el, referenceNode.nextSibling); } var loadjq = document.createElement(

Why does loading the libc shared library have “'LibraryLoader' object is not callable” error?

自闭症网瘾萝莉.ら 提交于 2019-12-02 12:35:36
问题 From https://en.wikipedia.org/wiki/Foreign_function_interface the ctypes module can load C functions from shared libraries/DLLs on-the-fly and translate simple data types automatically between Python and C semantics as follows: import ctypes libc = ctypes.CDLL( '/lib/libc.so.6' ) # under Linux/Unix t = libc.time(None) # equivalent C code: t = time(NULL) print t On Lubuntu 18.04 $ whereis libc libc: /usr/lib/x86_64-linux-gnu/libc.a /usr/lib/x86_64-linux-gnu/libc.so /usr/share/man/man7/libc.7

Max number of appdomains loaded in one process

北战南征 提交于 2019-12-01 18:21:24
Since dynamic assembly loading requires appdomain loading to enable killing the assembly with unloading related appdomain, is there a "max" number appdomains in a process to be loaded? I am thinking of a server based application that each user can run his proprietary C# code dynamically. But what if, say, 2000 users log in and load their codes? Are there any possible restrictions I might encounter besides the number of appdomians? thanks. Almost all CLR limits are based on "as memory permits". The only exception I know of is the number of members of a class, restricted to 65536. That's based

Help with Haskell dynamic plugin load

巧了我就是萌 提交于 2019-11-30 12:01:28
问题 I'm a Haskell beginner, and I'm trying to use the dynamic loading in the 'plugins' package. I'm kind of lost. Here is a minimal program with two files. Main.hs: module Main (main) where import System.Plugins main :: IO () main = do putStrLn "Loading" mv <- dynload "Plug.o" [] [] "thing" -- also try 'load' here putStrLn "Loaded" case mv of LoadFailure msgs -> putStrLn "fail" >> print msgs LoadSuccess _ v -> putStrLn "success" >> print (v::Integer) And Plug.hs: module Plug (thing) where thing :

Dynamic loading and weak symbol resolution

谁说我不能喝 提交于 2019-11-30 07:07:13
问题 Analyzing this question I found out some things about behavior of weak symbol resolution in the context of dynamic loading ( dlopen ) on Linux. Now I'm looking for the specifications governing this. Let's take an example. Suppose there is a program a which dynamically loads libraries b.so and c.so , in that order. If c.so depends on two other libraries foo.so (actually libgcc.so in that example) and bar.so (actually libpthread.so ), then usually symbols exported by bar.so can be used to