Warren Young wrote
> Evil has nothing to do with it. They are _necessary_ for Visual C++,
> and I thought they were necessary for MinGW since GCC supports the syntax.
> But this comment of yours made me wonder, what happens if you try to
> build a DLL with the declspecs turned off? Guess what: it works! I
> don't know why MinGW's GCC bothers to support this syntax if it doesn't
> do the right thing with it.
In fact there is a little history behind the _decspec(dllexport/dllimport),
they seemed to have a lot of usage for address translation in the days of
DOS and win16, which where almost the same thing. Their work was to provide
(at compile time) the addresses that the system will give inside the memory
of the program in order to emulate static library behavior, but it does not
happens any more on win32 (and surely win64) so I think the keywords were
left for compatibility and/or new behavior of address translation.
MinGW supports it because it needs to use the native built libraries of the
system, and they are all marked with those keywords, so they added ld som e
new interfaces, auto-import, auto-export and runtime-pseudo-relloc, which
are workaround for importing UNIXish libraries to windows.