c - Dynamic modules with DLLs on Windows -


I am writing an application in C, which can be extended through the module / share objects / DLL on runtime. Those modules can use the existing program's API, but can also provide new functions for use in the loaded modules later, so the module is expected to have dependence on each other.

My current view under Linux is that each module defines a dependent () function which gives a list of other module names that it depends. In this way, I can compile and link each module for myself, can load a module with the depletion () and RTLD_LAZY , first resolve your dependencies and then fix it Fully load with RTLD_GLOBAL . It works just fine and what exactly do I want This allows me to change a module without composing again all the other modules.

The real problem occurs when first of all when porting Windows, I have not found any way to link any DLL without providing any of its dependencies with the export symbol tables. . Did anybody ignore me?

Second, LoadLibraryEx does not seem to be able to load any lazy from windows API, because instead of driving me dependency, it goes forward and loads all referenced DLLs before it even returns Comes because I really want to check the version before loading the module in the future, so this is not exactly what I want. Is there any way to overcome this behavior?

The third strange thing is that I can not replace DLL instead of compiling all other modules on the basis of it. It actually works sometimes, but usually wild things start to happen or programs are sigfelt.

Is it possible to write such windows as modular applications?

Update: To provide just a few explanations of how my modules use other functions on Linux (which I want to do in Windows well): each The module simply gives the name of the second module, which wants to call it function in the dependency () function, and include its header, then the functions used in the code without any rapping directly The scroll. This works because Linux does not require you to resolve all the symbols at the link time for the shared object.

You can manually export all jobs ( __desxpack (dlxport) < / Code>) and load them using GetProcAddress . In this case you need to know the signature of each function, and you are limited to only the C function, but it is going to work. If you compile both modules, then your C function can return C ++ classes, and more on later. Using GetProcAddress & amp; Basically, the Load Library makes the module completely independent, you link manually, but as I think, this is what you do on Linux, is not it?

Load Libary loads only the libraries which depend on a library, so be sure that they do not load depending on one another or they actually Free, or they are not, if done properly, changing a library will not be compulsive to the second compilation (as you do not link them together).

A good idea is to use something like COM, so make each of your library an interface return, instead of different tasks, you can load the entire DLL and easily Can link with (passing an object -> passing a DLL). See XPCOM and COM, it's really easy to do.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -