why do i need an extern(C): here?
H. S. Teoh
hsteoh at quickfur.ath.cx
Thu Oct 15 22:07:52 UTC 2020
On Thu, Oct 15, 2020 at 09:47:16PM +0000, IGotD- via Digitalmars-d-learn wrote:
> On Thursday, 15 October 2020 at 21:29:59 UTC, WhatMeWorry wrote:
> > I've go a small DLL and a test module both written in D. Why do I
> > need to use the extern(C)? Shouldn't both sides be using D name
> > wrangling?
> You have answered your own question. If you're not using extern(C), D
> just like C++ adds a lot of name mangling which is not "addSeven" but
> extra characters as well. GetProcAddress which is a Windows call has
> no idea about D name mangling and therefore will not find the
You can use .mangleof to get the mangled name of a D function that you
can then lookup with GetProcAddress.
Notwithstanding the eloquent discontent that you have just respectfully expressed at length against my verbal capabilities, I am afraid that I must unfortunately bring it to your attention that I am, in fact, NOT verbose.
More information about the Digitalmars-d-learn