dynamic-loading

Load DLL exported data dynamically

南楼画角 提交于 2019-12-11 08:49:13
问题 Is there a version of GetProcAddress for exported data? I would like to do something like: Mydll.cpp: MyDataType::MyDataType(long, wchar_t*) { //Dummy code this->temp = 3; } __declspec(dllexport) MyDataType Here(50, L"random text"); MyClient.cpp: int main(void) { HINSTANCE hData = LoadLibrary("MyDll.dll"); reinterpret_cast<MyDataType*>(GetDataAddress(hData, "Here"))->DoSomething(); } That is, define an exported data ("Here") of UDT ("MyDataType"), and them obtain its address when the DLL is

When do .so files get loaded Linux?

自古美人都是妖i 提交于 2019-12-11 02:35:29
问题 I have a shared object (a.so) which is linked to my executable myexe. a.so exposed a method called get_val(), which myexe is using. Now when a.so will be loaded into myexe's process address space? is it when myexe calls get_val() API, or when myexe gets launched. 回答1: There are two (three) types of libraries: static libraries (suffix: .a / .lib ), which itself becomes part of the binary. Strictly speaking, it's not the whole library, it's those objects from the library which are required to

Dynamic load a .NET assembly with some other dll dependency

风流意气都作罢 提交于 2019-12-11 00:44:41
问题 I want to create a plugin engine for my app, but I have a problem: How can I load a .Net assembly (Actually my plugin) which has some dependency to other assembly. For example I want to load A.DLL and A.DLL need to B.dll or C.dll and so on to run. The A.dll has two method such as A() and B() . And A() or B() use some method of B.dll or C.dll . What should I do to dynamically load A.DLL and call A() or B() ? 回答1: Use AssemblyResolve event in the current AppDomain: To load DLLs: string[] dlls =

Dynamic loading of Haskell abstract syntax expression

China☆狼群 提交于 2019-12-10 05:10:15
问题 Can we use GHC API or something else to load not text source modules, but AST expressions, similar to haskell-src-exts Exp type? This way we could save time for code generation and parsing. 回答1: I don't think the GHC API exposes an AST interface (could be wrong though), but Template Haskell does. If you build expressions using the Language.Haskell.TH Exp structure, you can create functions/declarations and make use of them by the $(someTHFunction) syntax. A fairly major caveat is that TH only

Dynamically load apk that uses resources

邮差的信 提交于 2019-12-09 23:10:54
问题 I have service.apk that is using resources to show a notification in the status bar. I am dynamically loading the class that is using these resources but then the resources for the notifications disappear somehow, and I'm getting this error: W/ResourceType( 1142): No known package when getting value for resource number 0x7f020001 W/StatusBarIconView( 1142): Icon not found in 2130837505: 7f020001 W/StatusBarIconView( 1142): No icon for slot android/0x20 W/ActivityManager( 941):

Why is JDBC dynamically loaded instead of imported? [duplicate]

二次信任 提交于 2019-12-09 06:45:01
问题 This question already has answers here : Why we use Class.forName(“oracle.jdbc.driver.OracleDriver”) while connecting to a database? (7 answers) Closed last year . In JDBC, I only see examples using Class.forName("com.mysql.jdbc.Driver", true, cl); and haven't seen one using import com.mysql.jdbc.Driver; Is it because we want to let a driver package be dynamically provided at execution time, so can be known only at execution time? If we have a fixed driver package known before execution, is

Dynamic component loader - shared service for the resolving components

*爱你&永不变心* 提交于 2019-12-08 10:11:53
问题 I have to use ComponentFactoryResolver to add components dynamically. For my example, I have a modal window which I dynamically loaded after pressing some button on the view. And code for this action like this: let componentFactory = this.componentFactoryResolver.resolveComponentFactory(XYZComponent); let viewContainerRef = this.containerHost.viewContainerRef; viewContainerRef.clear(); let componentRef = viewContainerRef.createComponent(componentFactory); let _XYZComponent = componentRef

Loading Objective C code dynamically

邮差的信 提交于 2019-12-07 20:11:07
问题 I am looking for a possibility of loading Obj C based source dynamically and show the view in my iOS application. For example: I have a set of code written for showing a view, i want to dynamically load this code and show this view. Some thing like, I'll have a service running in the background of my iOS app. It will get a set of Obj C code from my server in text format This dynamic Obj C code should get executed dynamically and show the respective iOS view From Comments Not released in the

How do I make an Action Script 3 class, used in two SWF files, resolve to the same class when one SWF dynamically loads the other?

可紊 提交于 2019-12-07 14:22:56
问题 Background I am developing a highly modular application in pure Action Script 3 (we are using Flex 4 SDK to automate our builds, but all our code must be able to compile directly in Flash CS4 Professional). We have a "framework.swc" file which contains interface definitions which are shared between all our modules, we have a "mainmodule.swf" that loads our other modules, and then we have various .swf files for our other modules. We are using the Loader class, in conjuction with

How to handle “panic: the impossible happened” and continue in Haskell

穿精又带淫゛_ 提交于 2019-12-07 01:48:55
问题 I have the following code that uses the GHC API to load modules and get the type of an expression: typeObjects :: [String] -> [String] -> IO [Type] typeObjects modules objects = do defaultErrorHandler defaultDynFlags $ do runGhc (Just libdir) $ do dflags <- getSessionDynFlags setSessionDynFlags dflags targets <- mapM ((flip guessTarget) Nothing) modules setTargets targets result <- load LoadAllTargets case result of Failed -> error "Compilation failed" Succeeded -> do m <- mapM (((flip