Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Calling DLL Functions

import juno.base.native;

extern (Windows)
alias DllImport!("user32.dll", "MessageBeep", int function(uint type)) MessageBeep;

void main() {
  MessageBeep(-1);
}
import juno.base.native;

// Actual function name is "PathIsRelativeW"
extern (Windows)
alias DllImport!("shlwapi.dll", "PathIsRelative", int function(wchar* path), CharSet.Auto) PathIsRelative;

void main() {
  bool relative = PathIsRelative("file.txt");
}