[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:42:07 PDT 2014


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



--- Comment #3 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2014-03-23 03:42:05 PDT ---
(In reply to comment #2)
> -----
> version (Windows) extern(dll, "user32.dll")
> extern(C) void foo();
> 
> void main()
> {
>     foo();  // would fail on Posix since the entire block becomes invisible
> }
> -----

That wasn't a proper argument since the dll string name can be generated at
compile-time.

To provide a slightly better argument, let's say you have "foo.dll",
"foo_deb.dll" on Windows, and "foo.a", "foo_deb.a" on Posix. You'd end up
writing:

-----
version (Windows)
{
    debug
        enum dll_name = "foo.dll";
    else
        enum dll_name = "foo_deb";
}
else
version (Posix)
{
    debug
        enum dll_name = "foo.a";
    else
        enum dll_name = "foo_deb.a";
}

extern(dll, dll_name)
void foo();
-----

But then there might be issues where the shared library is named differently
based on the OS itself, some platform-specific naming conventions, x86 vs x64,
etc.. It would be simpler if you could just pass the shared library directly to
DMD.

-- 
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