A question about modules

orgoton orgoton at mindless.com
Tue Jun 12 11:03:46 PDT 2007


I suppose what you mean is to hide the source of you library, and/or not to have the source available at compile time. The solution is simple, pre-compile it.
In short, compile your library into a .lib file and ask DMD to generate a interface file (.di). Then, on your modules import the .di file and add:

pragma(lib, "libfile.lib"); //libfile.lib must be inside the dirs searched by DMD

or add the -Ilibfile.lib to your DMD command. The downside is that you either compile the lib in release/debug mode and that's it. If you want to change the build mode, you'll have to recompile the library. But that's not a real problem.



More information about the Digitalmars-d mailing list