On 2011-06-18 08:09, Daniel Murphy wrote:
One option that I see is to create a compiler plugin interface that lets a
build tool/package manager hook the compiler's import resolution process.

A very (very) basic implementation: (windows only)
https://github.com/yebblies/dmd/tree/importresolve

For those who don't want to read the source code:
The user (or the build tool, or in sc.ini/dmd.conf) supplies a dll/so on the
command line with:
dmd -ih=mylib.dll
Which exports a single function "_importhandler" that is called when a file
is not found on the include path.  It passes the module name and the
contents of the describing pragma, if any.
eg.
pragma(libver, "collection", "version", "hash")
import xpackage.xmodule;

calls
filename = importhandler("xpackage.xmodule", "collection", "version",
"hash")

and lets the library download, update etc, and return the full filename of
the required library.

That seems cool. But, you would want to write the pluing in D and that's not possible yet on all platforms? Or should everything be done with extern(C), does that work?

--
/Jacob Carlborg

Reply via email to