On 1/11/07, Chris Foster <foster@physics.uq.edu.au> wrote:
> +#include "../../rib/rib2ri/librib2ri.cpp"

Ah, can I ask why it was done this way Paul?  Why can't the build system
handle this rather than creating a new file?  I guess there's a good
reason, but it looks kinda nasty to me ;-)

The reason is, that file (librib2ri.cpp) is used in two places...

1) in libaqsis.so/aqsis.dll to provide the RIB-->RI mapping. In this case, the RI functions it will end up calling are included in the same module as another .cpp file ( ri.cpp), so the declarations in ri.h don't need to be __declspec(dllimport) for Win32, they need to be __declspec(dllexport) so that aqsis.dll exports the RI interface calls.

2) in miqser/miqser.exe to provide the RIB-->RI mapping again. In this case however, the RI funtions are provided by libri2rib.so/ri2rib.dll, so the declarations in ri.h need to be __declspec(dllimport) on Win32 to indicate they are imported from a shared library.

The way the dllimport/dllexport behaviour is controlled is via a macro RI_EXPORTS (defined to export, undefined to import), so this file ( librib2ri.cpp) needs to be compiled with two different sets of compiler options in the two use cases. I couldn't find a way to do this neatly in SCons, so I took the easy way out. I'm more than happy to be shown a better way.

Also, just in case you didn't know already, this commit breaks the linux
build - COMMON_SHARE not being defined I'd suppose?  I'm commiting a fix
- simply adding

#define COMMON_SHARE

to aqsistypes/posix/aqsis_compiler.h (hope that's fine)

~Chris.

Yep, my mistake, thanks for that, that is the correct fix.

Cheers


PaulG

--
Paul Gregory
http://www.aqsis.org