On 08.04.2017 22:33, Nierjerson wrote:
The project I am working on, which is near completion:

https://github.com/IllusionSoftware/COM2D

Automates COM wrapping almost completely. That is, it takes a converted
COM idl file and generates a D wrapper which handles all the marshaling,
invoking, creation, etc.

The problem is that DMD has started crashing when trying to compile the
complete set of interfaces. No error, warnings, etc. Just crashes.

Interesting project. In Visual D I had to marshal a couple of function calls manually, and that has been quite painful. Automating that process would be great.

A couple of notes:
- you can compile dmd as a 64-bit process using the VS solution in src/vcbuild.

- when built with this compiler the compile time generated string is output using about 8GB of memory.

- it still crashes after that due to a stack overflow (seems to be a compiler bug). You can avoid the recursion using the -allinst command line option at the cost of slightly more memory being used (should be very little in this project)

- compilation then continues but seems to be stalled. This is caused by the huge function GenerateDCOMClasses, that is still compiled into the object file even though it is just used at compile time. dmd is pretty slow compiling large funtions, you shouldn't dare enabling optimizations for these...

- eventually (using about 11 GB of memory) the object file is emitted with a size of 137 MB.

If possible you should avoid huge functions.

Would it be feasible to make the generation a runtime tool? If I understand correctly, you run idl2d on the interface file anyway, so integration with idl2d would make sense, too.

Reply via email to