hi
i have a question about how to arrange linkage between a "framework"
executable and an extensible set of "applet"s in DLLs that plug into the
executable.
the main exe is an application for managing interactions between "applets"
which live in the dlls. the main exe offers communications between the
applets, and also certain services that the applets can make use of. the
question is, how to offer these services to the dlls. they can be offered in
at least three ways, as follows. (i) offer them as exports from service.dll,
which ships with the executable. service.lib and service.h are offered so
that applets can be built against the service DLL. (ii) offer a dummy
service.dll which holds only stubs for these service functions, and at
startup arrange global variables in service.dll so they call up into the
executable. (iii) offer function pointers in service.dll, and at startup
initialise them to point at functions that are, in fact, exported from the
exe.
the services offered require integration across the applets, so it is not
possible to do (i), i.e. to compute them entirely within a service dll. the
other two solutions work, but both have inelegance and inefficiency
(additional call per function call in ii, or additional dereference step in
iii).
so i wondered if it is possible to offer the API as just a header file
(declarations), and have the dlls linked at run-time by the loader to these
functions (definitions) that are actually exported *from the executable*. as
a side benefit, a service DLL is actually unnecessary (it reduces to merely a
header file, and maybe a lib, though that isn't necessary either, really),
reducing the complexity of the solution.
that is, something like:
DLL <====EXE <====DLL
where both the exe can call the dll's exports, and vice versa.
the DLLs will be written in C or C++, depending on the taste of the client.
the exe is written in C++. all exports would be with C linkage, undecorated.
this is a cross-platform application, but it will be a start to establish
whether this is possible in windows.
thanks in advance