extern(Windows, "user32.dll")
Vladimir Panteleev via Digitalmars-d
digitalmars-d at puremagic.com
Sun Feb 1 02:26:24 PST 2015
The Delphi programming language allows specifying the DLL name
right on the declaration of extern symbols:
function GetVersion: DWORD; stdcall; external 'kernel32.dll';
I would like to suggest adding something similar to D:
extern(Windows, "kernel32.dll") DWORD GetVersion();
Rationale:
This absolves the need for import libraries.
* Import libraries are a major and unnecessary pain in the neck
when using DLLs of any kind.
* Import libraries may need conversion from COFF format to OMF
format with a tool which is not included with D (coffimplib).
* Import libraries can *sometimes* be created from the DLL using
implib, but this does not always work, depending on the calling
convention and its mangling.
* Name mangling mismatches are difficult to diagnose.
* Import libraries cannot be used with tools such as "rdmd",
except via pragma(lib).
Any thoughts? DIP or not?
More information about the Digitalmars-d
mailing list