[Issue 12443] Allow passing DLLs directly to DMD to avoid the need for creating import libraries

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Mar 23 03:24:27 PDT 2014


https://d.puremagic.com/issues/show_bug.cgi?id=12443



--- Comment #2 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2014-03-23 03:24:26 PDT ---
(In reply to comment #1)
> For the record, Delphi does away with import libraries completely and solves
> the DLL problem in the language. E.g.:
> 
> function MessageBoxA(hWnd: HWND; lpText, lpCaption: PChar; uType: UINT):
> Integer; stdcall; external 'user32.dll';
> 
> So in theory D could have an extern(dll, "user32.dll") attribute.

It would be a little complicated with platform-independent shared libraries.
For example:

-----
version (Windows) extern(dll, "user32.dll")
extern(C) void foo();

void main()
{
    foo();  // would fail on Posix since the entire block becomes invisible
}
-----

We currently cannot do the following:

-----
version (Windows)
    extern(C++):
else
    extern(C):

void foo();

void main()
{
}
-----

Unless this is fixed extern(dll, "user32.dll") would only be usable for Windows
DLLs, or you'd likely have to duplicate code / resort to string mixins and
other unreadable hacks..

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list