dllexport (was dllimport and initialization issue)
Michael Cronenworth
mike at cchtml.com
Thu Jul 22 19:36:28 UTC 2010
Kai Tietz wrote:
> Well, indeed you are doing here something wrong. As you declare global
> variable '_fmode' you have to use here instead of
> __declspec(dllimport) the attribute __declspec(dllexport) . The
> __declspec(dllimport) means for the compiler that the symbol '_fmode'
> has to imported from a different DLL into your app and by this you see
> those warnings.
Actually I did mean export -- I copied the wrong example.
__attribute__ ((dllexport)) int _fmode = _O_BINARY;
foo.c:123: warning: '_fmode' redeclared without dllimport attribute:
previous dllimport ignored
The code compiles fine, but I still get an annoying warning, which does
not make sense to me. Is it resolvable?
> Btw what exactly you want to do here with _fmode? It is part of the
C-runtime.
I am attempting to set O_BINARY as default so read() calls will give me
real data instead of translated garbage.
Thanks,
Michael
More information about the mingw
mailing list