[DGD] LPC Extensions 0.5.1
Felix A. Croes
felix at dworkin.nl
Fri Jun 11 17:59:22 CEST 2010
I've made version 0.5.1 available as a download from the project page:
http://sourceforge.net/projects/lpc-ext/
Please note that this is still alpha software! Bugs can be reported
on the same webpage.
The extension interface allows a kfun package to be completely independent
of Hydra and DGD. No actual source code of either is required to compile
it; packages can be compiled as modules that can be loaded at runtime
without ever #including, or being linked with DGD source code. I intend
to add more kfun packages in the future.
No structured datatype of Hydra/DGD is exposed by the interface. All
compound types are handled with pointers to opaque blobs; the addon kfun
does not even know (or have to know) the size of the value struct.
This complete separation from the driver could also be used for precompiled
objects. This is currently not supported and I do not plan to work on it
myself, but I have made it relatively easy for someone else to implement.
The C source code for precompiled objects #includes lpc_ext.h, and there
is a file by that name in dgd/src/lpc. Rather than a copy of
lpc-ext/src/lpc_ext.h from the extension interface, this file performs the
same function, but does so by including actual source code from DGD:
/* "fake" lpc_ext.h in dgd/src/lpc, #included by precompiled code */
# include "dgd.h"
# include ...
Int ext_frame_push_int(frame*, Int);
...
# define lpc_frame_push_int ext_frame_push_int
...
A precompiled object that #includes this file will be able to call
lpc_frame_push_int(), to push an integer value on the stack. Note that
lpc_frame_push_int() is not part of the extension interface (see the file
doc/Extensions for a list of lpc_frame_*() functions that are) and
precompiled code that makes use of it will be directly linked to it.
However, once the precompiler is rewritten to issue lpc_*() calls for
all functionality it requires, it would be a simple thing to add
lpc_frame_push_int() and all the rest to the extension interface,
and then it will be possible to use precompiled code in two ways;
either #include dgd/src/lpc/lpc_ext.h and link with the driver, or
#include lpc-ext/src/lpc_ext.h and build it as an add-on package that
can be loaded at runtime.
A list of functions currently provided by the extension interface can
be found in lpc-ext/src/lpc_ext.h. A list of functions currently
provided directly by DGD but following the same calling conventions
can be found in dgd/src/lpc/lpc_ext.h. In either case, the function
called is lpc_*() and the function in DGD where the call will wind up
is ext_*() (the source code can be found in dgd/src/ext.c).
Regards,
Felix Croes
More information about the DGD
mailing list