Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / CodeWarrior / November 2005



Tip: Looking for answers? Try searching our database.

No extras.h include in MSL <cstdio> for Carbon CFM in CodeWarrior 9?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dan Korn - 20 Nov 2005 17:46 GMT
I am porting a CFM Carbon project from CW 8.3 to CW 9.5, and I am
getting errors that the ANSI write() and close() functions are
undefined.

In both CW8 and CW9, these functions are declared in MSL's unistd.h,
like so:
_MSL_IMP_EXP_C int _MSL_CDECL close(int) _MSL_CANT_THROW;
_MSL_IMP_EXP_C int _MSL_CDECL write(int , const void*, __std(size_t))
_MSL_CANT_THROW;    /*- mm 000607 -*/

It took me some time to figure out why these declarations were not
being included in CW9.  I finally traced the problem to the file
<cstdio>.  In CW8, the MSL file <cstdio> includes these lines:

#if _MSL_NEEDS_EXTRAS
    #include <extras.h>
#endif

However, in CW9, this has been replaced with:

#if _MSL_NEEDS_EXTRAS && (__dest_os == __win32_os || __dest_os ==
__wince_os)
    #include <extras_stdio_win32.h>
#endif

But I wonder, why was this change made in <cstdio>?  I know that
extras.h is not supposed to be used in Mach-O, but why isn't it
included for CFM anymore?  If I include <extras.h> in my code, the
compiler errors go away and the write and close functions, and
everything else in extras, are still defined in MSL_All_Carbon_Lib.  So
why aren't they still included in the headers?

Thanks,
Dan
Ron L - 22 Nov 2005 16:33 GMT
>I am porting a CFM Carbon project from CW 8.3 to CW 9.5, and I am
>getting errors that the ANSI write() and close() functions are
>undefined.

write and close are not ansi,  they are POSIX

>In both CW8 and CW9, these functions are declared in MSL's unistd.h,

-- % snip % --

Correct but when the declaration is in more than one header (as is not
uncommon for POSIX) is confusing to developers and  library maintenance.

So if you included unistd.h it should pick up  MSL for the CFM but it
will pick up BSD implementation for the Mach-O version.

>  If I include <extras.h> in my code, the
>compiler errors go away and the write and close functions, and
>everything else in extras, are still defined in MSL_All_Carbon_Lib.  So
>why aren't they still included in the headers?

They are, and it is the approrpriate header unistd.h

Ron

Signature

CodeWarrior Community Forum is a free online resource for developers
to discuss CodeWarrior topics with other users and our staff
       --   http://www.codewarrior.com/community  --

Ron Liechty - ron.liechty@freescale.com - http://www.codewarrior.com

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.