[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
$111.78
Apple Inc.
-0.87
MSFT
$47.66
Microsoft Corpora
+0.14
GOOG
$516.35
Google Inc.
+5.25

MacTech Search:
Community Search:

Software Updates via MacUpdate

CleanApp 5.0.0 Beta 5 - Application dein...
CleanApp is an application deinstaller and archiver.... Your hard drive gets fuller day by day, but do you know why? CleanApp 5 provides you with insights how to reclaim disk space. There are... Read more
Monolingual 1.6.2 - Remove unwanted OS X...
Monolingual is a program for removing unnecesary language resources from OS X, in order to reclaim several hundred megabytes of disk space. It requires a 64-bit capable Intel-based Mac and at least... Read more
NetShade 6.1 - Browse privately using an...
NetShade is an Internet security tool that conceals your IP address on the web. NetShade routes your Web connection through either a public anonymous proxy server, or one of NetShade's own dedicated... Read more
calibre 2.13 - Complete e-library manage...
Calibre is a complete e-book library manager. Organize your collection, convert your books to multiple formats, and sync with all of your devices. Let Calibre be your multi-tasking digital librarian... Read more
Mellel 3.3.7 - Powerful word processor w...
Mellel is the leading word processor for OS X and has been widely considered the industry standard since its inception. Mellel focuses on writers and scholars for technical writing and multilingual... Read more
ScreenFlow 5.0.1 - Create screen recordi...
Save 10% with the exclusive MacUpdate coupon code: AFMacUpdate10 Buy now! ScreenFlow is powerful, easy-to-use screencasting software for the Mac. With ScreenFlow you can record the contents of your... Read more
Simon 4.0 - Monitor changes and crashes...
Simon monitors websites and alerts you of crashes and changes. Select pages to monitor, choose your alert options, and customize your settings. Simon does the rest. Keep a watchful eye on your... Read more
BBEdit 11.0.2 - Powerful text and HTML e...
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
ExpanDrive 4.2.1 - Access cloud storage...
ExpanDrive builds cloud storage in every application, acts just like a USB drive plugged into your Mac. With ExpanDrive, you can securely access any remote file server directly from the Finder or... Read more
Adobe After Effects CC 2014 13.2 - Creat...
After Effects CC 2014 is available as part of Adobe Creative Cloud for as little as $19.99/month (or $9.99/month if you're a previous After Effects customer). After Effects CS6 is still available... Read more

Latest Forum Discussions

See All

Make your own Tribez Figures (and More)...
Make your own Tribez Figures (and More) with Toyze Posted by Jessica Fisher on December 19th, 2014 [ permalink ] Universal App - Designed for iPhone and iPad | Read more »
So Many Holiday iOS Sales Oh My Goodness...
The holiday season is in full-swing, which means a whole lot of iOS apps and games are going on sale. A bunch already have, in fact. Naturally this means we’re putting together a hand-picked list of the best discounts and sales we can find in order... | Read more »
It’s Bird vs. Bird in the New PvP Mode f...
It’s Bird vs. Bird in the New PvP Mode for Angry Birds Epic Posted by Jessica Fisher on December 19th, 2014 [ permalink ] Universal App - Designed for iPhone and iPad | Read more »
Telltale Games and Mojang Announce Minec...
Telltale Games and Mojang Announce Minecraft: Story Mode – A Telltale Games Series Posted by Jessica Fisher on December 19th, 2014 [ permalink ] | Read more »
WarChest and Splash Damage Annouce Their...
WarChest and Splash Damage Annouce Their New Game: Tempo Posted by Jessica Fisher on December 19th, 2014 [ permalink ] WarChest Ltd and Splash Damage Ltd are teaming up again to work | Read more »
BulkyPix Celebrates its 6th Anniversary...
BulkyPix Celebrates its 6th Anniversary with a Bunch of Free Games Posted by Jessica Fisher on December 19th, 2014 [ permalink ] BulkyPix has | Read more »
Indulge in Japanese cuisine in Cooking F...
Indulge in Japanese cuisine in Cooking Fever’s new sushi-themed update Posted by Simon Reed on December 19th, 2014 [ permalink ] Lithuanian developer Nordcurrent has yet again updated its restaurant simulat | Read more »
Badland Daydream Level Pack Arrives to C...
Badland Daydream Level Pack Arrives to Celebrate 20 Million Downloads Posted by Ellis Spice on December 19th, 2014 [ permalink ] | Read more »
Far Cry 4, Assassin’s Creed Unity, Desti...
Far Cry 4, Assassin’s Creed Unity, Destiny, and Beyond – AppSpy Takes a Look at AAA Companion Apps Posted by Rob Rich on December 19th, 2014 [ permalink ] These day | Read more »
A Bunch of Halfbrick Games Are Going Fre...
A Bunch of Halfbrick Games Are Going Free for the Holidays Posted by Ellis Spice on December 19th, 2014 [ permalink ] Universal App - Designed for iPhone and iPad | Read more »

Price Scanner via MacPrices.net

The Apple Store offering free next-day shippi...
The Apple Store is now offering free next-day shipping on all in stock items if ordered before 12/23/14 at 10:00am PT. Local store pickup is also available within an hour of ordering for any in stock... Read more
It’s 1992 Again At Sony Pictures, Except For...
Techcrunch’s John Biggs interviewed a Sony Pictures Entertainment (SPE) employee, who quite understandably wished to remain anonymous, regarding post-hack conditions in SPE’s L.A office, explaining “... Read more
Holiday sales this weekend: MacBook Pros for...
 B&H Photo has new MacBook Pros on sale for up to $300 off MSRP as part of their Holiday pricing. Shipping is free, and B&H charges NY sales tax only: - 15″ 2.2GHz Retina MacBook Pro: $1699... Read more
Holiday sales this weekend: MacBook Airs for...
B&H Photo has 2014 MacBook Airs on sale for up to $120 off MSRP, for a limited time, for the Thanksgiving/Christmas Holiday shopping season. Shipping is free, and B&H charges NY sales tax... Read more
Holiday sales this weekend: iMacs for up to $...
B&H Photo has 21″ and 27″ iMacs on sale for up to $200 off MSRP including free shipping plus NY sales tax only. B&H will also include a free copy of Parallels Desktop software: - 21″ 1.4GHz... Read more
Holiday sales this weekend: Mac minis availab...
B&H Photo has new 2014 Mac minis on sale for up to $80 off MSRP. Shipping is free, and B&H charges NY sales tax only: - 1.4GHz Mac mini: $459 $40 off MSRP - 2.6GHz Mac mini: $629 $70 off MSRP... Read more
Holiday sales this weekend: Mac Pros for up t...
B&H Photo has Mac Pros on sale for up to $500 off MSRP. Shipping is free, and B&H charges sales tax in NY only: - 3.7GHz 4-core Mac Pro: $2599, $400 off MSRP - 3.5GHz 6-core Mac Pro: $3499, $... Read more
Save up to $400 on MacBooks with Apple Certif...
The Apple Store has Apple Certified Refurbished 2014 MacBook Pros and MacBook Airs available for up to $400 off the cost of new models. An Apple one-year warranty is included with each model, and... Read more
Save up to $300 on Macs, $30 on iPads with Ap...
Purchase a new Mac or iPad at The Apple Store for Education and take up to $300 off MSRP. All teachers, students, and staff of any educational institution qualify for the discount. Shipping is free,... Read more
iOS and Android OS Targeted by Man-in-the-Mid...
Cloud services security provider Akamai Technologies, Inc. has released, through the company’s Prolexic Security Engineering & Research Team (PLXsert), a new cybersecurity threat advisory. The... Read more

Jobs Board

*Apple* Store Leader Program (US) - Apple, I...
…Summary Learn and grow as you explore the art of leadership at the Apple Store. You'll master our retail business inside and out through training, hands-on experience, Read more
Project Manager, *Apple* Financial Services...
**Job Summary** Apple Financial Services (AFS) offers consumers, businesses and educational institutions ways to finance Apple purchases. We work with national and 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
*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...
Job Description: Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.