[MD1] Updating ANSI C/C++ from CW/10 to CW/11
TweetFollow Us on Twitter

[MD1] Updating ANSI C/C++ from CW/10 to CW/11

From: Ron Liechty (mwron@metrowerks.com)

CodeWarriors,

With CW/11 Metrowerks has changed the default ANSI C and C++ Libraries from
a version licensed from Plum-Hall to Metrowerks owned libraries. These
Libraries all source codes as well as projects you can modify to build
custom libraries are located in the Metrowerks Standard Library folder, and
are referred to as MSL C and MSL C++. We are still providing (and will
continue to provide for some time) the older versions of the ANSI C and C++
libraries. These are located on the CodeWarrior Tools CD in the Metrowerks
CodeWarrior : ( Obsolete ANSI Libraries) folder.

Providing our own libraries allows us to ship the source code so users that
want to build their own custom libraries or fine tune the provided code may
do so. Furthermore, the Proposed ANSI/ISO Standard for C++ is now in the
final stages and this new MSL C++ Library is more compliant than the
previous Plum Hall version.

If you are updating older projects moving to these versions may have little
effect or may mean several simple changes will need to be made.

Please Read all release notes and the FAQ's appended to this note.

NOTE: Before updating any project make sure you save a copy of your old
project first. The updater will not do this. This is critical if you have
problems and wish to go back to the previous ANSI libraries.

NO ANSI LIBRARIES USED.

If you do not use the ANSI library routines in your project you may delete
them from your project if they are present along with any SIOUX library.
You may need to remove these access paths.

Optionally you may want to change the runtime library from CPlusPlus.Lib
(for 68k) to MSL Runtime68k.LIb or change MWCRuntime.lib to MSL
RuntimePPC.Lib (for PowerPC). The older runtimes are still provided but
this change now may be useful for future uses. However to do this you will
need to add abort_exit.c to the MSL runtime project and rebuild the
project, it was forgotten in the last drop onto the CD.

ANSI C LIBRARIES USED

If you use the ANSI C libraries in your project you will need to replace
the ANSI C versions with the MSL Versions. If you are using 68k libraries
only certain versions are provided. You may have to build your own
libraries to conform to your project settings. (see FAQ below). SIOUX
console input and output is built into MSL C Library a separate library
is no longer needed.

If you have any libraries in your project that were linked against the
older headers or libraries you will need to rebuild them or revert back to
the older libraries.

You will have to change the runtime library from CPlusPlus.Lib (for 68k)
to MSL Runtime68k.LIb or change MWCRuntime.lib to MSL RuntimePPC.Lib for
the PowerPC projects.

You will need to adjust your Access paths to point to the Metrowerks
CodeWarrior : Metrowerks Standard Library : MSL C folder. If recursion is
off you will also want to set it for the MSL C : MSL Common : Public
Includes and MSL C : MSL Mac : Public Includes folders. You may need to
but probably will not need to adjust the access paths for the missing ANSI
Libraries.

If you use only ANSI C Libraries and no MacToolbox make sure your projects
prefix file is set to ansi_prefix.mac.h (this setting is made in your
project preferences : C/C++ Language settings.

If you use MacToolbox and ANSI C you will need to create a prefix file.
The easiest way is to create your own precompile header using the
ansi_prefix.mac.h file in the Metrowerks Standard Libraries : MSL C : MSL
Mac : Public Includes folder.

Un-comment the precompiler directives and the #include (MacHeaders.c)
lines, select precompile from your project menu and grab a cup of coffee.
When it has finished it will ask for a name, save it with a descriptive
name and use it for your prefix file.

For more information on creating a precompiled header read the IDE Users
Guide page 300 Creating Precompiled Headers.

ANSI C++ LIBRARIES USED

If you are using ANSI C++ Libraries you must do the all of the above for
ANSI C libarries plus add the Metrowerks Standard Library : MSL C++ and
Metrowerks Standard Library : MSL C++ : Library Support folders to your
access paths.

You will need to replace the ANSI C++ library with the appropriate MSL C++
Library.

If you wish to use the enable Bool support option you will need to rebuild
your MSL C++ Library. If a version of the Library is not provided for your
settings you will also have to build a custom C++ Library (see FAQ below)
It is suggested you rebuild this library with inlining off until a patch is
released for the C/C++ Compiler.

POWERPLANT WITH ANSI

You will need to do all of the above for ANSI C and ANSI C++ plus you may
need to do the following

You should recompile your precompiled header files to have matching
settings. This can be accomplished by the use of custom precompiled header
files (or if you already use one, you should be in good shape).

For the PP Classes you can do this to create your precompiled header file.

Find the Project Stationary folder in the Basic PowerPlant stationary
folder (68k or PPC, doesn't matter). You'll see 2 files in there
"MyPP_DebugHeaders.pch++/.h". COPY those two files to your project's
folder. Add the .pch++ file to your project. Go into your project's
Project Settings, C/C++ Language Settings. In the Prefix File edit field
enter "MyPP_DebugHeaders.h" (no quotes).

Don't forget to put a
#include (ansi_prefix.mac.h)
or
#include (ansi_parms.h)
#define __dest_os __mac_os

in your project somewhere. For some people, putting it into the
"MyPP_DebugHeaders.h" file works fine. For others, they put it into the
.pch++ file.

INSTALLING PREVIOUS VERSION OF ANSI C/C++

If you do not wish to update to the MSL C or MSL C++ Libraries you may
chose to reinstall the older versions. This is recommended for those who
are maintaining older code.

copy the folders ANSI Headers and STL Headers from the Tools CD Metrowerks
CodeWarrior : (Obsolete ANSI Libraries) : INTO MacOS Support folder : INTO
Headers folder
into the Metrowerks CodeWarrior : MacOS Support : Headers folder on your
hard drive

copy the folders ANSI 68K, ANSI PPC and SIOUX from the Tools CD Metrowerks
CodeWarrior : (Obsolete ANSI Libraries) : INTO MacOS Support folder : INTO
Libraries folder
into the Metrowerks CodeWarrior : MacOS Support : Libraries folder on your
hard drive

You may chose to copy old project stationery from the CW/10 version of
CodeWarrior or save and existing project in your Metrowerks CodeWarrior
(Project Stationery) folder in the appropriate sub folder as a stationery.

FAQ's ABOUT METROWERKS STANDARD LIBRARY

Q: I need an A4 version of my library but none is provided what should I do.

A: Metrowerks will soon provide several more libraries on our web site for
downloading or you may want to create your own custom library.

HOW TO BUILD YOUR OWN LIBRARIES

Open the MSL folder and in the MSL C or MSL C++ folder you will find a
project for example MSL C.68K.u. Open this project and change the
following settings.

Project Preferences
Give this library a descriptive name I suggest you use the Metrowerks
naming conventions but are free to use any name. If you are creating an A4
relative library you need to set this in this preference.

C/C++ Language Preferences
Set these preferences to conform to your projects settings. Note in PowerPC
projects now the enable bool support requires coinciding library settings.
We currently recommend that inlining be turned off until a patch is
released soon.

68k Processor Preferences
Set these preferences to match your project settings.

)From the Project Menu select make.

Q: The C++ Compile times are slow, I thought my computer had frozen.

A: Yes because of the way the compiler is doing inlining and the way the
MSL C++ is inlined has led to some excessive build times especially on
slower 68k machines. Metrowerks is working on a patch for this which will
be available soon. In the mean time it is suggested you build your projects
with inlining off.

You may also want to increase your disk cache in your Memory Control Panel
settings. A 1 - 2 Mb should help if you can spare it. The default is 96k
which is inadequate.

Q: The code has jumped in size

A: This is due to the inlining, Please rebuild your project and the
Library with inlining turned off. This will reduce the size to a large
extent. Metrowerks is working on the MSL C++ as well as the Compilers
inlining to reduce this. A patch will be available soon.

Q: When I compile my code with iostream I get an error in Vector.h

A: The project stationery supplied on CW/11 incorrectly has MacHeaders.h
as the prefix file. Please change this to ansi_prefix.mac.h this will
solve these problems. You may want to change the setting in your project
stationery for future use as well.

Q: My code that compiled fine with MSL in CW/10 no longer compiles with
various errors with vectors and iterators.

A : There was a major change in the container interface, and it forces
container declarations to change as follows:

OLD: vector( YOUR_OBJECT_TYPE ) vect_i0;
NEW: vector( YOUR_OBJECT_TYPE , allocator( YOUR_OBJECT_TYPE ) )
vect_i0;

Note this is for all containers, not just vectors (list, map, etc.)

Also, if you have a non-standard type (i.e. not bool, short, u short, long,
u long, long long, etc. etc. ) then you'll need to make an iterator_traits
specialization for it right after the definition of this type (in whatever
.cpp file this type is defined). (check to make sure that you've included
the header (iterator.h) too)

you do this with this form

null_template
struct iterator_trait (unsigned int) {
typedef ptrdiff_t distance_type;
typedef unsigned int value_type;
typedef random_access_iterator_tag iterator_category;
};

Q: Ever since I installed the MSL I get an error in exceptions.c

A: This is not a problem with MSL this is a problem with the inlining of
the C/C++ Compiler creating more inline functions in a code block that the
internal exception handling can hold. Metrowerks is working on a patch in
the meantime turn inlining off.

Q: Since I updated to MSL my old code that worked before now reports a 32k
reference is out of range error.

A: This is due to the inlining, Metrowerks is working on a patch. In the
meantime if turning inlining in your project off does not work then you
will need to rebuild your libraries with inlining off.

Q: I used to use console.stubs.c to reduce the size of my application when
I used the ANSI libraries without Console I/O what should I do now.

A: Console.stubs.c is no longer necessary as the initializations are built
into the MSL C library and will be stripped out by the linker.

Q: I changed from MWCRuntime to MSL RuntimePPC.Lib and I now get the error.
Link Error : undefined 'exit' (code)
Referenced from '__start' in MSL RuntimePPC.Lib

A: Just add abort_exit.c to the MSL runtime project and rebuild the
project, it was forgotten in the last drop onto the CD.

Q: I can't use MSL and standard input extractor (cin ))) to input a zero
value.

A: Yes this is a bug in MSL C++ libraries it has been corrected and will
be on the next patch coming soon.

Q: I get an internal compiler error with operands.c

A: This is a bug in the C/C++ compiler when you implicitly convert a float
to a double, as in an assignment or arithmetic equation. This has been
corrected and will be fixed in the patch coming out soon. In the mean time
the work around is to simply use doubles instead of float types.

Ron Liechty

 
AAPL
$102.76
Apple Inc.
+0.51
MSFT
$44.91
Microsoft Corpora
+0.03
GOOG
$569.77
Google Inc.
+0.57

MacTech Search:
Community Search:

Software Updates via MacUpdate

VueScan 9.4.41 - Scanner software with a...
VueScan is a scanning program that works with most high-quality flatbed and film scanners to produce scans that have excellent color fidelity and color balance. VueScan is easy to use, and has... Read more
Cloud 3.0.0 - File sharing from your men...
Cloud is simple file sharing for the Mac. Drag a file from your Mac to the CloudApp icon in the menubar and we take care of the rest. A link to the file will automatically be copied to your clipboard... Read more
LibreOffice 4.3.1.2 - Free Open Source o...
LibreOffice is an office suite (word processor, spreadsheet, presentations, drawing tool) compatible with other major office suites. The Document Foundation is coordinating development and... Read more
SlingPlayer Plugin 3.3.20.505 - Browser...
SlingPlayer is the screen interface software that works hand-in-hand with the hardware inside the Slingbox to make your TV viewing experience just like that at home. It features an array of... Read more
Get Lyrical 3.8 - Auto-magically adds ly...
Get Lyrical auto-magically add lyrics to songs in iTunes. You can choose either a selection of tracks, or the current track. Or turn on "Active Tagging" to get lyrics for songs as you play them.... Read more
Viber 4.2.2 - Send messages and make cal...
Viber lets you send free messages and make free calls to other Viber users, on any device and network, in any country! Viber syncs your contacts, messages and call history with your mobile device,... Read more
Cocktail 7.6 - General maintenance and o...
Cocktail is a general purpose utility for OS X that lets you clean, repair and optimize your Mac. It is a powerful digital toolset that helps hundreds of thousands of Mac users around the world get... Read more
LaunchBar 6.1 - Powerful file/URL/email...
LaunchBar is an award-winning productivity utility that offers an amazingly intuitive and efficient way to search and access any kind of information stored on your computer or on the Web. It provides... Read more
Maya 2015 - Professional 3D modeling and...
Maya is an award-winning software and powerful, integrated 3D modeling, animation, visual effects, and rendering solution. Because Maya is based on an open architecture, all your work can be scripted... Read more
BBEdit 10.5.12 - Powerful text and HTML...
BBEdit is the leading professional HTML and text editor for the Mac. Specifically crafted in response to the needs of Web authors and software developers, this award-winning product provides a... Read more

Latest Forum Discussions

See All

Stupeflix Has Released a Major Update fo...
Stupeflix Has Released a Major Update for Replay Posted by Jessica Fisher on August 29th, 2014 [ permalink ] iPhone App - Designed for the iPhone, compatible with the iPad | Read more »
ALONE… Review
ALONE… Review By Jennifer Allen on August 29th, 2014 Our Rating: :: MINIMALISTIC AND TOUGHUniversal App - Designed for iPhone and iPad Tough yet satisfying, ALONE… is a challenging endless flyer with some suitably sensitive... | Read more »
Hyperlapse Review
Hyperlapse Review By Jennifer Allen on August 28th, 2014 Our Rating: :: SPEEDY VIDEO SNAPSUniversal App - Designed for iPhone and iPad Want to make a great time-lapse video quickly? Hyperlapse is perfect for that.   | Read more »
Back To Bed Review
Back To Bed Review By Jennifer Allen on August 28th, 2014 Our Rating: :: STYLISH BUT LIMITEDUniversal App - Designed for iPhone and iPad It looks gorgeous, but Back to Bed is actually a fairly simple and uneventful puzzle game.   | Read more »
New Cars, New Locations, and a New Seaso...
New Cars, New Locations, and a New Season in Asphalt 8: Airborne Update Posted by Jessica Fisher on August 28th, 2014 [ permalink ] Universal App - Designed for iPhone and iPad | Read more »
Award Winning Children’s Book Bedtime fo...
Bedtime for Sarah Sullivan is a children’s storybook that emphasizes the importance of going to bed, dreams, and those magical moments right before being tucked in. Now Kelly Paniagua, author of the award-winning children’s book, is planning to... | Read more »
Happy Cube Death Arena Review
Happy Cube Death Arena Review By Jordan Minor on August 28th, 2014 Our Rating: :: CUBEDUniversal App - Designed for iPhone and iPad Happy Cube Death Arena is adorably violent, but very, very shallow.   | Read more »
8bit Doves, the New Game from Icebreaker...
8bit Doves, the New Game from Icebreaker Developers Nitrome, is Now Available – and in Four Colours Posted by Ellis Spice on August 28th, 2014 [ | Read more »
Ace Ferrara and the Dino Menace Review
Ace Ferrara and the Dino Menace Review By Nadia Oxford on August 28th, 2014 Our Rating: :: DINO-MYTEUniversal App - Designed for iPhone and iPad Ace Ferrara and the Dino Menace combines space combat and weird humor into a fun game... | Read more »
Draw Stuff, Win Prizes. Glorkian Warrior...
Draw Stuff, Win Prizes. | Read more »

Price Scanner via MacPrices.net

New 21″ 1.4GHz iMac on sale again for $999, s...
Best Buy has the new 21″ 1.4GHz iMac on sale for $999.99 on their online store. Their price is $100 off MSRP. Choose free shipping or free local store pick up. Price is for online orders only, in-... Read more
Smartphone Outlook Remains Strong for 2014, U...
According to a new mobile phone forecast from the International Data Corporation (IDC) Worldwide Quarterly Mobile Phone Tracker, more than 1.25 billion smartphones will be shipped worldwide in 2014,... Read more
Save up to $60 with Apple refurbished iPod to...
The Apple Store has Apple Certified Refurbished 5th generation iPod touches available starting at $149. Apple’s one-year warranty is included with each model, and shipping is free. Many, but not all... Read more
12-Inch MacBook Air Coming in 4Q14 or 2015 –...
Digitimes’ Aaron Lee and Joseph Tsai report that according to Taiwan-based upstream supply chain insiders, Apple plans to launch a thinner MacBook model either at year end 2014 or in 2015, and that... Read more
Sapphire Screen “Most Wanted” iPhone 6 New Fe...
According to the ‘uSell.com iPhone Most Wanted Survey’ — a representative survey of 1,000 U.S. smartphone users conducted by used iPhone marketplace uSell.com — close to half of all smartphone users... Read more
The iPad’s Real Competitive Challenger (Not S...
It’s been my contention for some time that the iPad is suffering from something of an identity crisis, and I suspect that may be a factor in slackening sales this year. Apple can’t seem to decide... Read more
13-inch 2.6GHz/256GB Retina MacBook Pro on sa...
B&H Photo has the 13″ 2.6GHz/256GB Retina MacBook Pro on sale for $1379 including free shipping plus NY sales tax only. Their price is $120 off MSRP. Read more
Life Inventory iOS Apps – Learn to Know Thyse...
James Hollender’s Life Inventory apps s are now on sale with 20% off thru Labor Day, 09/01/2014. This is a great opportunity to get started on that Moral Inventory you’ve been putting off doing for... Read more
Pocket Watch, LLC. Reveals Cloud Server For P...
Beaumont, Texas based Pocket Watch, LLC. has announced the availability of its new ActivePrint Cloud Server Powered by Raspberry Pi. With this small standalone box almost any USB printer or available... Read more
902it Simplifies Area Code Changes For Nova S...
The east coast Canadian provinces of Nova Scotia and Prince Edward Island are phasing in 10 digit telephone dialing, to be fully in place by November, in order to accommodate a second area code to... Read more

Jobs Board

*Apple* Retail - Multiple Positions (US) - A...
Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, you're also the Read more
*Apple* Retail - Multiple Positions (US) - A...
Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, you're also the Read more
Senior Event Manager, *Apple* Retail Market...
…This senior level position is responsible for leading and imagining the Apple Retail Team's global event strategy. Delivering an overarching brand story; in-store, Read more
*Apple* Solutions Consultant (ASC) - Apple (...
**Job Summary** The ASC is an Apple employee who serves as an Apple brand ambassador and influencer in a Reseller's store. The ASC's role is to grow Apple Read more
Project Manager / Business Analyst, WW *Appl...
…a senior project manager / business analyst to work within our Worldwide Apple Fulfillment Operations and the Business Process Re-engineering team. This role will work Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.