[Issue 1306] extern (Windows) should work like extern (C) for variables

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jul 2 09:41:03 PDT 2007


http://d.puremagic.com/issues/show_bug.cgi?id=1306





------- Comment #2 from torhu at yahoo.com  2007-07-02 11:41 -------
I nailed, it's another problem with the export keyword.


stdcall.d:
---
export extern (Windows) void (*funcptr)(int);

void main()
{
    funcptr(5);
}
---

Just to show how funcptr gets mangled:

c:\prog\test\D>dmd stdcall
c:\prog\dmd\bin\..\..\dm\bin\link.exe stdcall,,,user32+kernel32/noi;
OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

c:\prog\dmd\bin\..\lib\phobos.lib(dmain2)
 Error 42: Symbol Undefined _funcptr at 0
--- errorlevel 1


funcptr is mangled as _funcptr at 0, which I believe is a stdcall function of zero
arguments.  This is clearly wrong, and won't link with the corresponding C
definition of the function pointer.


-- 



More information about the Digitalmars-d-bugs mailing list