digitalmars.D.bugs - [Issue 4581] New: extern function pointers inside functions
- d-bugmail puremagic.com (28/28) Aug 04 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4581
- d-bugmail puremagic.com (15/15) Aug 04 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4581
- d-bugmail puremagic.com (8/8) Aug 04 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4581
- d-bugmail puremagic.com (9/9) Aug 04 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4581
- d-bugmail puremagic.com (9/13) Oct 26 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4581
- d-bugmail puremagic.com (10/10) Jan 22 2013 http://d.puremagic.com/issues/show_bug.cgi?id=4581
http://d.puremagic.com/issues/show_bug.cgi?id=4581
Summary: extern function pointers inside functions
Product: D
Version: D2
Platform: Other
OS/Version: Windows
Status: NEW
Keywords: link-failure, rejects-valid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody puremagic.com
ReportedBy: simen.kjaras gmail.com
PDT ---
import std.c.windows.windows;
The following code compiles, but does not link:
void main(string[] args) {
extern (Windows) HINSTANCE ShellExecuteW(HWND, LPCWSTR, LPCWSTR,
LPCWSTR, LPCWSTR, INT);
HINSTANCE i = ShellExecuteW(null, "open",
"http://www.example.com", null, null, SW_SHOW);
}
Error 42: Symbol Undefined
__D4test4mainFAAyaZi13ShellExecuteWMWT4core3sys7windows7windows6HANDLEPxuPxuPxuPxuiZT4core3sys7windows7windows6HANDLE 24
As we can see, the symbol is D mangled, which it should not be.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 04 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4581
nfxjfg gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |nfxjfg gmail.com
It's a feature, not a bug. If the declaration is contained in something nested
(like a struct, I guess it also applies to functions), name extern doesn't
disable mangling.
You can ask Walter for the why.
However I didn't find this in the spec and I could be wrong, so I'll leave it
to others to find this and mark the bug as invalid.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 04 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4581 PDT --- I cannot foresee any instance in which it is wanted that the compiler disregard the extern declaration, and even if this is the case, there should at least be a warning as it blithely ignores the programmer's intention. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 04 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4581 10:07:30 PDT --- You can't express intention with extern attribute, because it's ambiguous: whether it specifies an external function or internal function with specific calling convention. Currently there's no way to differentiate between these two cases. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 04 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4581 PDT ---You can't express intention with extern attribute, because it's ambiguous: whether it specifies an external function or internal function with specific calling convention. Currently there's no way to differentiate between these two cases.But is there really a difference? Currently, extern( foo ) means 'use foo's calling conventions and name mangling'. As long as the latter is also part of the definition, I do not see such a difference. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 26 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4581
Andrej Mitrovic <andrej.mitrovich gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |andrej.mitrovich gmail.com
10:36:04 PST ---
Walter can we get your opinion on this?
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 22 2013









d-bugmail puremagic.com 