[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

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

Top Mobile Game Discounts
Every day, we pick out a curated list of the best mobile discounts on the App Store and post them here. This list won't be comprehensive, but it every game on it is recommended. Feel free to check out the coverage we did on them in the links... | Read more »
Price of Glory unleashes its 1.4 Alpha u...
As much as we all probably dislike Maths as a subject, we do have to hand it to geometry for giving us the good old Hexgrid, home of some of the best strategy games. One such example, Price of Glory, has dropped its 1.4 Alpha update, stocked full... | Read more »
The SLC 2025 kicks off this month to cro...
Ever since the Solo Leveling: Arise Championship 2025 was announced, I have been looking forward to it. The promotional clip they released a month or two back showed crowds going absolutely nuts for the previous competitions, so imagine the... | Read more »
Dive into some early Magicpunk fun as Cr...
Excellent news for fans of steampunk and magic; the Precursor Test for Magicpunk MMORPG Crystal of Atlan opens today. This rather fancy way of saying beta test will remain open until March 5th and is available for PC - boo - and Android devices -... | Read more »
Prepare to get your mind melted as Evang...
If you are a fan of sci-fi shooters and incredibly weird, mind-bending anime series, then you are in for a treat, as Goddess of Victory: Nikke is gearing up for its second collaboration with Evangelion. We were also treated to an upcoming... | Read more »
Square Enix gives with one hand and slap...
We have something of a mixed bag coming over from Square Enix HQ today. Two of their mobile games are revelling in life with new events keeping them alive, whilst another has been thrown onto the ever-growing discard pile Square is building. I... | Read more »
Let the world burn as you have some fest...
It is time to leave the world burning once again as you take a much-needed break from that whole “hero” lark and enjoy some celebrations in Genshin Impact. Version 5.4, Moonlight Amidst Dreams, will see you in Inazuma to attend the Mikawa Flower... | Read more »
Full Moon Over the Abyssal Sea lands on...
Aether Gazer has announced its latest major update, and it is one of the loveliest event names I have ever heard. Full Moon Over the Abyssal Sea is an amazing name, and it comes loaded with two side stories, a new S-grade Modifier, and some fancy... | Read more »
Open your own eatery for all the forest...
Very important question; when you read the title Zoo Restaurant, do you also immediately think of running a restaurant in which you cook Zoo animals as the course? I will just assume yes. Anyway, come June 23rd we will all be able to start up our... | Read more »
Crystal of Atlan opens registration for...
Nuverse was prominently featured in the last month for all the wrong reasons with the USA TikTok debacle, but now it is putting all that behind it and preparing for the Crystal of Atlan beta test. Taking place between February 18th and March 5th,... | Read more »

Price Scanner via MacPrices.net

AT&T is offering a 65% discount on the ne...
AT&T is offering the new iPhone 16e for up to 65% off their monthly finance fee with 36-months of service. No trade-in is required. Discount is applied via monthly bill credits over the 36 month... Read more
Use this code to get a free iPhone 13 at Visi...
For a limited time, use code SWEETDEAL to get a free 128GB iPhone 13 Visible, Verizon’s low-cost wireless cell service, Visible. Deal is valid when you purchase the Visible+ annual plan. Free... Read more
M4 Mac minis on sale for $50-$80 off MSRP at...
B&H Photo has M4 Mac minis in stock and on sale right now for $50 to $80 off Apple’s MSRP, each including free 1-2 day shipping to most US addresses: – M4 Mac mini (16GB/256GB): $549, $50 off... Read more
Buy an iPhone 16 at Boost Mobile and get one...
Boost Mobile, an MVNO using AT&T and T-Mobile’s networks, is offering one year of free Unlimited service with the purchase of any iPhone 16. Purchase the iPhone at standard MSRP, and then choose... Read more
Get an iPhone 15 for only $299 at Boost Mobil...
Boost Mobile, an MVNO using AT&T and T-Mobile’s networks, is offering the 128GB iPhone 15 for $299.99 including service with their Unlimited Premium plan (50GB of premium data, $60/month), or $20... Read more
Unreal Mobile is offering $100 off any new iP...
Unreal Mobile, an MVNO using AT&T and T-Mobile’s networks, is offering a $100 discount on any new iPhone with service. This includes new iPhone 16 models as well as iPhone 15, 14, 13, and SE... Read more
Apple drops prices on clearance iPhone 14 mod...
With today’s introduction of the new iPhone 16e, Apple has discontinued the iPhone 14, 14 Pro, and SE. In response, Apple has dropped prices on unlocked, Certified Refurbished, iPhone 14 models to a... Read more
B&H has 16-inch M4 Max MacBook Pros on sa...
B&H Photo is offering a $360-$410 discount on new 16-inch MacBook Pros with M4 Max CPUs right now. B&H offers free 1-2 day shipping to most US addresses: – 16″ M4 Max MacBook Pro (36GB/1TB/... Read more
Amazon is offering a $100 discount on the M4...
Amazon has the M4 Pro Mac mini discounted $100 off MSRP right now. Shipping is free. Their price is the lowest currently available for this popular mini: – Mac mini M4 Pro (24GB/512GB): $1299, $100... Read more
B&H continues to offer $150-$220 discount...
B&H Photo has 14-inch M4 MacBook Pros on sale for $150-$220 off MSRP. B&H offers free 1-2 day shipping to most US addresses: – 14″ M4 MacBook Pro (16GB/512GB): $1449, $150 off MSRP – 14″ M4... Read more

Jobs Board

All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.