Skip to content

Instantly share code, notes, and snippets.

@dkorpel
Created July 28, 2019 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dkorpel/df2c2f567588bb8ee59e293146e52723 to your computer and use it in GitHub Desktop.
Save dkorpel/df2c2f567588bb8ee59e293146e52723 to your computer and use it in GitHub Desktop.

List of dub packages using extern(...) in mixin templates

Context: Issue 20012 - export inside mixin doesn't seem to work

By parsing all .d files in all 1584 currently registered and available git repositories on Dub using libdparse, it was found that 13 packages have a LinkageAttribute inside a MixinTemplateDeclaration. The total number of mixin templates is 1497. Note: libdparse crashed on dmd's test suite, so dmd was skipped, but that shoudln't be important. Below is an overview for each package why extern() is used, with a link to one of the instances where it's used:


awebview: extern(C++) interfacing link

de_bindings: extern(C) only used for function pointer types link

derelict-glfw3: extern(C) only used for function pointer type aliases link

DPlug: extern(Windows) functions are override, can't be mixed in at global scope link

Godot-D: uses pragma(mangle) to get proposed behavior link

Spasm: uses pragma(mangle) to get proposed behavior link

autowrap: mixes in static _py_init_impl, gets mangled correctly? link

HexChatD: uses pragma(mangle) to get proposed behavior link

dlangui: mixes in WinMain, should only be mixed in once link

mir-pybind: uses pragma(mangle) to get proposed behavior, but also defines rtAtExit multiple times. This would break. link

Reloaded: has __crash_return_handler function, only meant to be mixed in once link

mir-pybuffer: uses pragma(mangle) to get proposed behavior link

erupted: extern(C) only used for function pointer type aliases link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment