making a really simple dll.

Kai Meyer kai at unixlords.com
Thu Aug 18 12:42:20 PDT 2011


On 08/18/2011 01:32 PM, Trass3r wrote:
> Am 18.08.2011, 21:17 Uhr, schrieb Adam D. Ruppe
> <destructionator at gmail.com>:
>> We should make a mixin template DllMain that has a generic main.
>
> We should also have a -shared switch that transparently includes all of
> the boilerplate crap:
> particularly the .def file, maybe even a default DllMain if none exists.

This would be my vote. -shared will:
1) check if there is a DllMain defined at the end, and if not, sticks a 
generic one in there
2) check if there are any exported functions (via .def or export()), if 
not, export them all

That way, the OP's original simple 1 function d file compiles to a dll.

Same goes for the Linux side. Default constructor and destructors that 
initialize and destroy the D runtime if there aren't any defined at the 
end of the compilation.

-Kai Meyer


More information about the Digitalmars-d-learn mailing list