A few notes on choosing between Go and D for a quick project

rumbu via Digitalmars-d digitalmars-d at puremagic.com
Mon Mar 16 03:24:43 PDT 2015

On Monday, 16 March 2015 at 10:02:46 UTC, Rikki Cattermole wrote:
>> So instead of writing:
>> extern(Windows) DWORD GetVersion(),
>> we can write:
>> extern(Windows, "api-ms-win-core-sysinfo-l1-2-1.dll", [optional
>> funcname]) DWORD GetVersion() or
>> extern(Windows, "kernel32.dll") DWORD GetVersion() for older 
>> Windows
>> versions (<8).
>> I know probably a mixin will partially solve this, but this 
>> will save
>> some important boilerplate code (just look at DerelictOrg 
>> bindings,
>> thousands LOC just to load some functions from a dll).
> Don't, please don't dare me...
> I could totally do this with UDA's and CTFE for function 
> pointers.
> Plus my new total secret API could make this trivial to hook 
> into.

Been there, done that: 

alias GetVersion = 
DllImport!("api-ms-win-core-sysinfo-l1-2-1.dll", "GetVersion", 
DWORD function())

I didn't achieve more than that, i consider this ugly, 
non-intellisense friendly, that's whay a builtin language 
construct will be better. Can't wait to see your total super 
secret API :)

More information about the Digitalmars-d mailing list