Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem with shared libraries on Mac OX



Dear All,
  Please find a small tar file which evidentiates a problem with the g++
compiler or the linker. Here is the story. I make a dylib that contains a
global entity which is a class. This class contains a static member, which
is again a class. The parent class of this is a pure virtual class. One of
the member functions of this class is called in the constructor of the
class associated with the global variable. This function exists in the
base class and calls a function that is pure abstract in the base class
but implemented in the derived class. When the dylib is loaded, the global 
variable is initialised, the class constructor is called, the function in 
the base class is called correctly. However when this function calls the 
other function, which is pure abstract in the base class and implemented 
in the derived class, the program dies.
  On SunOS, Alpha OSF1, Linux (both IA32 and AI64, g++ and intel 
compilers) and windows/cygwin this short program works correctly. On 
MacOSX 10.3 with g++ and ibm xlC compilers the program dies with 

[/Users/fca/sstest] gdb ./sstest 
GNU gdb 5.3-20030128 (Apple version gdb-330.1) (Fri Jul 16 21:42:28 GMT 2004)
Copyright 2003 Free Software Foundation, Inc.
[...]
Reading symbols for shared libraries ... done
(gdb) run
Starting program: /Users/fca/sstest/sstest 
Reading symbols for shared libraries +. done
Static::ctor
Virtual::Print

Program received signal EXC_BAD_ACCESS, Could not access memory.
0x0001ff00 in Virtual::Print() (this=0x27420) at static.cxx:21
21        PrintAdd();
(gdb)

 All the elements of the picture are necessary, including the static data 
member. I would be glad if someone could help me with this. Best regards, 


                                            Federico Carminati

==============================================================================
|| Federico Carminati             ||  Telephone : +41.22.767.4959           ||
|| CERN-EP                        ||  Fax       : +41.22.767.9480           ||
|| 1211 Geneva 23                 ||  Mobile    : +41.76.487.4843           ||
|| Switzerland                    ||                                        ||
==============================================================================

Attachment: sstest.tgz
Description: GNU Zip compressed data

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Unix-porting mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/unix-porting/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.