Welcome to MacForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

PP MACH-O limits.h vs. climits - many multiple defined sym..

 
   Macintosh computer (Home) -> Programmer Code RSS
Next:  Has anyone created an non-dependent LStr class?  
Author Message
Kent Sorensen

External


Since: Aug 24, 2003
Posts: 38



(Msg. 1) Posted: Sun Aug 24, 2003 3:10 pm
Post subject: PP MACH-O limits.h vs. climits - many multiple defined symbo
Archived from groups: comp>sys>mac>programmer>codewarrior, others (more info?)

I have a large PowerPlant application that is using the PP network
classes. I want to finally put those classes out to pasture and use
socket based code instead.

Some sample code I found includes <arpa/inet.h> but this is causing a
large number of symbol redefinitions between the MSL climits and
/ust/include/ppc/limits.h


To reproduce this simply make a new PP C++ Mach-O advanced sample
project and include <arpa/inet.h> in one of the project headers.

You will see a large number of redefinitions, including CHAR_BIT,
MB_LEN_MAX

This is on OS X 10.2.6, latest official dev tools, IDE 5.1.1, CW 8.3

The sample project is completely unmodified except for the addition of
the <arpa/inet.h> header.

What do I need to do to be able to mix socket based code with a
MSL/PowerPlant application ?

Should I remove all vestiges of MSL and use whatever standard library
the machine comes with ?

Kent

 >> Stay informed about: PP MACH-O limits.h vs. climits - many multiple defined sym.. 
Back to top
Login to vote
Alex Curylo

External


Since: Aug 24, 2003
Posts: 22



(Msg. 2) Posted: Sun Aug 24, 2003 3:23 pm
Post subject: Re: PP MACH-O limits.h vs. climits - many multiple defined s [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

in article kents-55C5AC.12101624082003.RemoveThis@nr-ott01.bellnexxia.net, Kent
Sorensen at kents.RemoveThis@snak.REMOVETHIS.com wrote on 8/24/03 9:10 AM:

 > What do I need to do to be able to mix socket based code with a
 > MSL/PowerPlant application ?

As well as <arpa/inet.h>, <netdb.h> will give you trouble too. The code
below was of use during MSL->BSD conversion in my latest project. Got it to
compile without excessive whining and bitching, anyway.

 > Should I remove all vestiges of MSL and use whatever standard library
 > the machine comes with ?

I did eventually for said project and haven't had any reason to regret the
decision and several to consider it a good one. Mind you, it's not
PowerPlant based, which could very well throw some wrinkles in the works for
you.

Anyway, the code, from the header to my Winsock emulation routines.
"VS_TARGET_OS_MAC" is our cross-platform flag doing the same job as
TARGET_OS_MAC in Apple-headered code and can be ignored by you.


#include <sys/types.h>
#include <sys/time.h>
#include <sys/fcntl.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include </usr/include/unistd.h>

#if VS_TARGET_OS_MAC && _MSL_USING_MW_C_HEADERS

/* not in <string.h> */
#define bzero(b,len) (memset((b), '\0', (len)), (void) 0)
/* MSL <climits> */
#undef CHAR_BIT
#undef MB_LEN_MAX
#undef SCHAR_MAX
#undef SCHAR_MIN
#undef UCHAR_MAX
#undef CHAR_MAX
#undef CHAR_MIN
#undef USHRT_MAX
#undef SHRT_MAX
#undef SHRT_MIN
#undef SHRT_MAX
#undef UINT_MAX
#undef INT_MAX
#undef INT_MIN
#undef ULONG_MAX
#undef LONG_MAX
#undef LONG_MIN
#undef LLONG_MIN
/* MSL <csignal> */
#undef SIGINT
#undef SIGILL
#undef SIGABRT
#undef SIGFPE
#undef SIGSEGV
#undef SIGTERM
#undef SIG_DFL
#undef SIG_IGN
#undef SIG_ERR

#endif /* VS_TARGET_OS_MAC && _MSL_USING_MW_C_HEADERS */

#include <netdb.h>
#include <arpa/inet.h>

--
Alex Curylo -- alex.RemoveThis@alexcurylo.com -- <a style='text-decoration: underline;' href="http://www.alexcurylo.com/" target="_blank">http://www.alexcurylo.com/</a>

"Wow ‹ you're quite the Casanova! We can tell you're a real woman-magnet and
are never without an admirer or three. When combined with your significant
charm, your attentive, sensitive demeanor makes you irresistible."
-- 'Are You a Suave Guy?', <a style='text-decoration: underline;' href="http://www.emode.com" target="_blank">www.emode.com</a><!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: PP MACH-O limits.h vs. climits - many multiple defined sym.. 
Back to top
Login to vote
Kent Sorensen

External


Since: Aug 24, 2003
Posts: 38



(Msg. 3) Posted: Mon Aug 25, 2003 12:51 am
Post subject: Re: PP MACH-O limits.h vs. climits - many multiple defined s [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

  > > Should I remove all vestiges of MSL and use whatever standard library
  > > the machine comes with ?
 >
 > I did eventually for said project and haven't had any reason to regret the
 > decision and several to consider it a good one. Mind you, it's not
 > PowerPlant based, which could very well throw some wrinkles in the works for
 > you.

Thank you for the reply. I will look into applying the changes. However,
I think that abandoning MSL is the better approach. Can you tell me what
I need to do ?

The application will be OS X only.

It doesn't appear like CW's new project templates contain any samples
that uses the standard library.

Thanks
Kent<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: PP MACH-O limits.h vs. climits - many multiple defined sym.. 
Back to top
Login to vote
Alex Curylo

External


Since: Aug 24, 2003
Posts: 22



(Msg. 4) Posted: Mon Aug 25, 2003 10:43 am
Post subject: Re: PP MACH-O limits.h vs. climits - many multiple defined s [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

in article kents-A6B0E7.21512824082003 RemoveThis @nr-tor02.bellnexxia.net, Kent
Sorensen at kents RemoveThis @snak.REMOVETHIS.com wrote on 8/24/03 6:51 PM:

 > Thank you for the reply. I will look into applying the changes. However,
 > I think that abandoning MSL is the better approach. Can you tell me what
 > I need to do ?

1) Get rid of all the MSL access paths and replace them with system access
paths, and turn on 'Require Framework Includes'. My System Paths in Access
Paths pane then looks like

( ) {OS XVolume}usr/include
( ) {OS XVolume}usr/lib
(f) {OS XVolume}System/Library/Frameworks
(r) {Compiler}MacOS X Support

where ( ) is not recursive, (r) is recursive, and (f) is that little
frameworks script f. (Yes, this is Mach-o, I figure if you're doing a CFM
project you probably want OS 9 compatibility, and that means you're going to
use MSL, right?)

2) Lose all the MSL libraries and replace them with

usr/lib/crt1.o
MacOS X Support/Libraries/Runtime/Libs/MSL_Runtime_Mach-O_D.a

3) That's pretty much it far as I remember. Here's the debug target .pch++,
the portions relevant to stdlib usage anyway, I believe most of these
defines are irrelevant now that MSL headers are rooted out completely but
they'll probably help you during the conversion process. The various pragmas
are just there because I like them on, I don't think they have any
particular affect on the BSD v. MSL question.


#pragma precompile_target "MacSIPClientBSDDebug++"

#define TARGET_API_MAC_CARBON 1
#define DEBUG 1
// see <CarbonCore/Debugging.h>
#define kComponentSignatureString "MacSIPClient"
#define DEBUG_ASSERT_COMPONENT_NAME_STRING "MacSIPClient"
#define COMPONENT_SIGNATURE '????'

#pragma once on

#define __dest_os __mac_os_x
#define MSL_USE_PRECOMPILED_HEADERS 0
#define _MSL_USING_MW_C_HEADERS 0
#define _MSL_MACHEADERS_INCLUDES_CMATH 0
// notes about <cmath> vs <fp.h> in here -- we're not using MSL C
//#include "MacHeadersMach-O.c"
#define __NOEXTENSIONS__
#define __CF_USE_FRAMEWORK_INCLUDES__
//#include <ansi_prefix.mach.h>
#include <Carbon/Carbon.h>

#pragma check_header_flags on
#pragma warn_no_side_effect on
#pragma warn_padding on


No guarantees of correctness made for these instructions past that they
apparently produce a functioning program for me, if anybody has any
corrections to make they probably know more than I do.

--
Alex Curylo -- alex RemoveThis @alexcurylo.com -- <a style='text-decoration: underline;' href="http://www.alexcurylo.com/" target="_blank">http://www.alexcurylo.com/</a>

"As good a writer as Kevin is, he is only human. I think that for
an effective "three strikes and you're out" policy on this list,
we should let Alex deal with the third-time offenders..."
-- John Wiseman<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: PP MACH-O limits.h vs. climits - many multiple defined sym.. 
Back to top
Login to vote
MW Ron

External


Since: Aug 04, 2003
Posts: 1662



(Msg. 5) Posted: Mon Aug 25, 2003 1:12 pm
Post subject: Re: PP MACH-O limits.h vs. climits - many multiple defined s [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <kents-A6B0E7.21512824082003.RemoveThis@nr-tor02.bellnexxia.net>,
Kent Sorensen <kents.RemoveThis@snak.REMOVETHIS.com> wrote:

   >> > Should I remove all vestiges of MSL and use whatever standard library
   >> > the machine comes with ?
  >>
  >> I did eventually for said project and haven't had any reason to regret the
  >> decision and several to consider it a good one. Mind you, it's not
  >> PowerPlant based, which could very well throw some wrinkles in the works for
  >> you.
 >
 >Thank you for the reply. I will look into applying the changes. However,
 >I think that abandoning MSL is the better approach. Can you tell me what
 >I need to do ?

Change the precompiled header so it doesn't use MSL Headers. I forget
the exact which one but you'll find where it is defined if you check on
it.

 >The application will be OS X only.
 >
 >It doesn't appear like CW's new project templates contain any samples
 >that uses the standard library.

MSL is the Standard Library, but you probably mean the BSD lib and it's
POSIX functions.

Anyway it is simple to do, change the access path order and change the
define in one of PowerPlants prefix files.

What I'd do is create a copy of that header with the change and create
your own precompiled header source (.pch++) file so it doesn't bite you
later.

If you need detailed information or the exact header and line to change
let me know and I'll dig it all up.

Ron

--
CodeWarrior Development Studio for Macintosh v9
Enhance Your Productivity and Shorten your Development Cycles
<http://store.metrowerks.com/>
Sales and Support 512-996-5300 800-377-5416
Ron Liechty - MWRon.RemoveThis@metrowerks.com - <a style='text-decoration: underline;' href="http://www.metrowerks.com" target="_blank">http://www.metrowerks.com</a><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: PP MACH-O limits.h vs. climits - many multiple defined sym.. 
Back to top
Login to vote
Kent Sorensen

External


Since: Aug 24, 2003
Posts: 38



(Msg. 6) Posted: Tue Aug 26, 2003 1:11 pm
Post subject: Re: PP MACH-O limits.h vs. climits - many multiple defined s [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

 > Change the precompiled header so it doesn't use MSL Headers. I forget
 > the exact which one but you'll find where it is defined if you check on
 > it.
<snip>
 > If you need detailed information or the exact header and line to change
 > let me know and I'll dig it all up.

Thanks for the reply. I tried doing this and there is a few problems
since this is a PowerPlant application.

The first one is the #include <exception> in LException.h and the second
one is #include <cstddef> from LString.h

There's also some issues with debugnew which is getting included
somehow. Of course that will have to go.

Kent<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: PP MACH-O limits.h vs. climits - many multiple defined sym.. 
Back to top
Login to vote
MW Ron

External


Since: Aug 04, 2003
Posts: 1662



(Msg. 7) Posted: Tue Aug 26, 2003 2:40 pm
Post subject: Re: PP MACH-O limits.h vs. climits - many multiple defined s [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <kents-79C998.10112926082003.TakeThisOut@news21.bellnet.ca>,
Kent Sorensen <kents.TakeThisOut@snak.REMOVETHIS.com> wrote:

  >> Change the precompiled header so it doesn't use MSL Headers. I forget
  >> the exact which one but you'll find where it is defined if you check on
  >> it.
 ><snip>
  >> If you need detailed information or the exact header and line to change
  >> let me know and I'll dig it all up.
 >
 >Thanks for the reply. I tried doing this and there is a few problems
 >since this is a PowerPlant application.
 >
 >The first one is the #include <exception> in LException.h and the second
 >one is #include <cstddef> from LString.h

those are C++ headers and you only want to use the C headers and
libraries.

 >There's also some issues with debugnew which is getting included
 >somehow. Of course that will have to go.

Again that is C++ and nothing to do with C lib. But you don't need to
use that.

Ron

--
CodeWarrior Development Studio for Macintosh v9
Enhance Your Productivity and Shorten your Development Cycles
<http://store.metrowerks.com/>
Sales and Support 512-996-5300 800-377-5416
Ron Liechty - MWRon.TakeThisOut@metrowerks.com - <a style='text-decoration: underline;' href="http://www.metrowerks.com" target="_blank">http://www.metrowerks.com</a><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: PP MACH-O limits.h vs. climits - many multiple defined sym.. 
Back to top
Login to vote
Display posts from previous:   
   Macintosh computer (Home) -> Programmer Code All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]