It's Microsoft's way of thumbing their nose at POSIX and ANSI by  
(intentionally) adding a porting burden so their proprietary APIs are  
preferred, but I digress..

On Aug 25, 2008, at 8:39 PM, Tom Browder wrote:

> We have been having some Windows issues with the Loki library, and
> today Ron got an error in a file that include a BRL-CAD error that was
> similar to the Loki error (something about _write not being defined).

Did you include io.h?  Not being defined sounds like a missing header  
at least.  I highly suspect that in your particular situation that  
may have been multiple compensations somehow going on with  
interactions between Loki, Qt, and/or BRL-CAD headers all trying to  
use various preprocessor directives to make a work-around in  
conflicting ways.

> When we looked at the header (config_win.h) we saw:
>
> #define write _write
> ...
> // etc.
>
> We then split out the BRL-CAD-using functions into a separate file
> where we eliminated interaction with Qt (fiddles with libc write/read
> for windows) and Loki (uses libc write/read) headers.  That seems to
> have cured the problem so far (fingers crossed), but I'm not happy
> with our fix (I want to use Loki SafeFormat with BRL-CAD functions
> under Windows).
>
> Why is 'config_win.h' doing that?  We have seen earlier when debugging
> see that that conversion (user libc function names being changed to
> add an underscore in front of the name) seems to be taken care of
> automatically by MSVC++.

If I'm not mistaken, the actual symbols in MSVC's libraries are  
prefixed with an underscore so if it's working without it, there's  
some header/preprocessor/compiler directive influencing matters.   
Microsoft uses the prefix on most of the POSIX declarations  
(intentionally) and iirc all of the ANSI symbols.  For at least some  
versions of MSVC, it used to be required to use the underscore in  
order to avoid symbol errors:

http://msdn.microsoft.com/en-us/library/45aft37a(VS.71).aspx

Regardless, looking through the latest MSDN docs, it looks as though  
some of the POSIX symbols are provided both prefixed and non-prefixed  
at least as of VC2005 (no idea about the ANSI ones).  The non- 
prefixed POSIX symbol names, though, are deprecated:

http://msdn.microsoft.com/en-us/library/ms235384(VS.80).aspx

Cheers!
Sean


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
BRL-CAD Developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-devel

Reply via email to