Hi.
It seems that if DLL is used on Windows the binary mode
(int _fmode = _O_BINARY; ) must be set in a module
even if it is already set in the library (gis, G__open)
Does it make sense? How to do it?
If I add it to gis.h compiler fails with:
multiple definition of `__fmode'
Radim
Radim Blazek wrote:
It seems that if DLL is used on Windows the binary mode
(int _fmode = _O_BINARY; ) must be set in a module
even if it is already set in the library (gis, G__open)
Does it make sense?
Yes.
On Unix, the loader doesn't care where symbols come from as long as
all imports are ultimately resolved somehow. On Windows, each import
is tied to a specific file (DLL or executable); if a DLL imports a
symbol from the executable, the symbol has to be defined in the
executable, not in a DLL.
How to do it?
If I add it to gis.h compiler fails with:
multiple definition of `__fmode'
Awkward (unless you manually add it to every module, but that's a fair
amount of work). Thinking out loud:
Change the linking command to link every executable against an object
file which defines that symbol.
Or have a special case for compiling files named "main.c" to add e.g.
-DMAIN then use "#ifdef MAIN" to control whether to define the symbol
(some modules use a different filename, but you could always define
__fmode manually in those few cases).
--
Glynn Clements <glynn@gclements.plus.com>