symmetryinvestments / autowrap

Wrap existing D code for use in Python, Excel, C#
BSD 3-Clause "New" or "Revised" License
80 stars 16 forks source link

Write files on CTFE #250

Open andre2007 opened 4 years ago

andre2007 commented 4 years ago

I might have a solution for the missing write files on CTFE issue. Or more precise, with next version of Dub it will be possible.

The app postgen.d gets the folder path to the dub package, which has a dependency to autowrap, as console argument. In addition it reads the 3 new environment variables DUB_ROOT_PACKAGE_TARGET_TYPE, DUB_ROOT_PACKAGE_TARGET_PATH and DUB_ROOT_PACKAGE_TARGET_NAME. Therefore it knows the shared object file which was built and can call the metadata function. The metadata can now be used to create the `cs´ files.

The benefit is, you do not longer need 2 different configurations (wrap and emit). Just executing dub build will create the SO and also the cs files are automatically created.

The drawback is, you need a very recent dub version (The 3 new environment variable were just added to master).