[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
$101.06
Apple Inc.
+0.10
MSFT
$47.06
Microsoft Corpora
-0.46
GOOG
$587.37
Google Inc.
-8.71

MacTech Search:
Community Search:

Software Updates via MacUpdate

Evernote 5.6.0 - Create searchable notes...
Evernote allows you to easily capture information in any environment using whatever device or platform you find most convenient, and makes this information accessible and searchable at anytime, from... Read more
Monosnap 2.2.2 - Versatile screenshot ut...
Monosnap allows you to save screenshots easily, conveniently, and quickly, sharing them with friends and colleagues at once. It's the ideal choice for anyone who is looking for a smart and fast... Read more
Tunnelblick 3.4beta36 - GUI for OpenVPN...
Tunnelblick is a free, open source graphic user interface for OpenVPN on OS X. It provides easy control of OpenVPN client and/or server connections. It comes as a ready-to-use application with all... Read more
SoftRAID 5.0.4 - High-quality RAID manag...
SoftRAID allows you to create and manage disk arrays to increase performance and reliability. SoftRAID's intuitive interface and powerful feature set makes this utility a must have for any Mac OS X... Read more
Audio Hijack Pro 2.11.3 - Record and enh...
Audio Hijack Pro drastically changes the way you use audio on your computer, giving you the freedom to listen to audio when you want and how you want. Record and enhance any audio with Audio Hijack... Read more
Airfoil 4.8.9 - Send audio from any app...
Airfoil allows you to send any audio to AirPort Express units, Apple TVs, and even other Macs and PCs, all in sync! It's your audio - everywhere. With Airfoil you can take audio from any... Read more
WhatRoute 1.13.0 - Geographically trace...
WhatRoute is designed to find the names of all the routers an IP packet passes through on its way from your Mac to a destination host. It also measures the round-trip time from your Mac to the... Read more
Chromium 37.0.2062.122 - Fast and stable...
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all Internet users to experience the web. FreeSMUG-Free OpenSource Mac User Group build is... Read more
Attachment Tamer 3.1.14b9 - Take control...
Attachment Tamer gives you control over attachment handling in Apple Mail. It fixes the most annoying Apple Mail flaws, ensures compatibility with other email software, and allows you to set up how... Read more
Duplicate Annihilator 5.0 - Find and del...
Duplicate Annihilator takes on the time-consuming task of comparing the images in your iPhoto library using effective algorithms to make sure that no duplicate escapes. Duplicate Annihilator detects... Read more

Latest Forum Discussions

See All

This Week at 148Apps: September 15-19, 2...
Expert App Reviewers   So little time and so very many apps. What’s a poor iPhone/iPad lover to do? Fortunately, 148Apps is here to give you the rundown on the latest and greatest releases. And we even have a tremendous back catalog of reviews; just... | Read more »
Kitty Powers’ Matchmaker – Tips, Tricks,...
Hey There, Kittens: | Read more »
Goblin Sword Review
Goblin Sword Review By Andrew Fisher on September 22nd, 2014 Our Rating: :: RETRO GOODNESSUniversal App - Designed for iPhone and iPad Fun visuals, good music, engaging level design, and lots of content make Goblin Sword an... | Read more »
Major New Update for CSR Racing Adds Fer...
Major New Update for CSR Racing Adds Ferrari and Multiplaye​r Posted by Jessica Fisher on September 22nd, 2014 [ permalink ] | Read more »
Veditor Review
Veditor Review By Jennifer Allen on September 22nd, 2014 Our Rating: :: PIMP YOUR VIDEOUniversal App - Designed for iPhone and iPad Want to add stickers and music to your videos? Veditor can do that easily.   | Read more »
1849′s Nevada Silver DLC is Still Search...
A few months ago, I took a look at 1849 from SomaSim. This Gold Rush-themed city builder for iPad had a fair bit going for it, but lacked in a few crucial areas to make it a true stand-out on the App Store. SomaSim has since added in a sandbox mode... | Read more »
Fruit Ninja Will be Reborn With a Massiv...
Fruit Ninja Will be Reborn With a Massive Update and Origins Animation Series Posted by Jessica Fisher on September 22nd, 2014 [ permalink ] Halfbrick Studios is rebuilding | Read more »
Daniel Tiger’s Grr-ific Feelings Review
Daniel Tiger’s Grr-ific Feelings Review By Amy Solomon on September 22nd, 2014 Our Rating: iPad Only App - Designed for the iPad Daniel Tiger’s Grr-ific Feelings includes activities that allow young children explore different... | Read more »
CloudMagic Updated for iOS 8 – Adds Inte...
CloudMagic Updated for iOS 8 – Adds Interactive Notifications, Share Extension, and More Posted by Jessica Fisher on September 22nd, 2014 [ | Read more »
Starbase Annex (Games)
Starbase Annex 1.0 Device: iOS Universal Category: Games Price: $1.99, Version: 1.0 (iTunes) Description: "it’s really very clever... a little bit of Hearthstone and a dash of Eclipse" - PocketTactics.com From the creator of Starbase... | Read more »

Price Scanner via MacPrices.net

Apple restocks some refurbished 2014 MacBook...
The Apple Store has restocked some Apple Certified Refurbished 2014 MacBook Airs, with prices starting at $769. An Apple one-year warranty is included with each MacBook, and shipping is free. These... Read more
13-inch 128GB MacBook Air on sale for $949, s...
B&H Photo has the new 2014 13″ 1.4GHz/128GB MacBook Air on sale for $949.99 including free shipping plus NY tax only. Their price is $50 off MSRP. B&H will also include free copies of... Read more
Apple offering free $25 iTunes Gift Card with...
The Apple Store is offering a free $25 iTunes Gift Card with the purchase of a $99 Apple TV for a limited time. Shipping is free. Read more
Apple refurbished iPod touch available for up...
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. Most colors are... Read more
iFixIt Tears Down iPhone 6; Awards Respectabl...
iFixit notes that even the smaller 4.7″ iPhone 6 is a giant among iPhones; so big that Apple couldn’t fit it into the familiar iPhone form factor. In a welcome reversal of a recent trend to more or... Read more
Phone 6 Guide – Tips Book For Both iPhone 6...
iOS Guides has announced its latest eBook: iPhone 6 Guide. Brought to you by the expert team at iOS Guides, and written by best-selling technology author Tom Rudderham, iPhone 6 Guide is packed with... Read more
How to Upgrade iPhone iPad to iOS 8 without D...
PhoneClean, a iPhone cleaner utility offered by iMobie Inc., reveals a solution for upgrading iPhone and iPad to iOS 8 without deleting photos, apps, the new U2 album or anything. Thanks to more than... Read more
Inpaint 6 – Photo Retouching Tool Gets Faster...
TeoreX has announced Inpaint 6, a simple retouching tool for end users that helps remove scratches, watermarks, and timestamps as well as more complex objects like strangers, unwanted elements and... Read more
Worldwide PC Monitor Market Sees Growth in To...
Worldwide PC monitor shipments totaled 32.5 million units in the second quarter of 2014 (2Q14), a year-over-year decline of -2.9%, according to the International Data Corporation (IDC) Worldwide... Read more
Updated Price Trackers
We’ve updated our Mac Price Trackers with the latest information on prices, bundles, and availability on systems from Apple’s authorized internet/catalog resellers: - 15″ MacBook Pros - 13″ MacBook... Read more

Jobs Board

*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
Position Opening at *Apple* - Apple (United...
…customers purchase our products, you're the one who helps them get more out of their new Apple technology. Your day in the Apple Store is filled with a range of 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
Position Opening at *Apple* - Apple (United...
**Job Summary** At the Apple Store, you connect business professionals and entrepreneurs with the tools they need in order to put Apple solutions to work in their Read more
Position Opening at *Apple* - Apple (United...
**Job Summary** The Apple Store is a retail environment like no other - uniquely focused on delivering amazing customer experiences. As an Expert, you introduce people Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.