public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: raymond@cdlsystems.com To: gcc-gnats@gcc.gnu.org Subject: c++/9796: dynamic cast in shared library failed Date: Sat, 22 Feb 2003 00:06:00 -0000 [thread overview] Message-ID: <20030221235851.24314.qmail@sources.redhat.com> (raw) >Number: 9796 >Category: c++ >Synopsis: dynamic cast in shared library failed >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Sat Feb 22 00:06:01 UTC 2003 >Closed-Date: >Last-Modified: >Originator: raymond@cdlsystems.com >Release: GCC 3.2 >Organization: >Environment: linux >Description: When a class is created in the main function and passing it off to a shared library for downcasting, dynamic cast returns null. typedef void ( *PFN )( Parent* ); int main() { Parent parent; Child child; void* pDl = dlopen ( "libshared.so", RTLD_GLOBAL|RTLD_NOW); PFN pfnAcquire = ( PFN )dlsym( pDl, "function1" ); printf( "before %x %x\n", &child, dynamic_cast<Child*>( &child )); pfnAcquire( &child ); } In the acquired function from the shared library, if the same dynamic cast operation is done again, the result is always null. When compiling the so file, -Wl,-E is used. See the attached script >How-To-Repeat: use the provided script to recompile the program and run it. >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: application/x-zip-compressed; name="dynamiccast.zip" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="dynamiccast.zip" UEsDBBQAAAAIAC+CVS7gQl6EgwAAAKsAAAAKAAAAc2hhcmVkLmN4eE2NQQrCMBRE9/8UQ0RISxFc K256gR5AkJCk9kP7I+mvVMS7SxDF2c3wHrNh8eMSIoxP05RkNxiiuGrMAtMauicO6Bfxykn2Fp3L UbSGunyNioqeBOCWWbS3MCyYE7YrvJs1BmgpZzENCvbNR27+p/AQN7G/FO/YDjyG+mR/L9WBXvQG UEsDBBQAAAAIAMuCVS6vh+4RlQAAADUBAAAIAAAAY29tbW9uLmiVjjEOwjAMRXef4qss7cIBCmLh AhyAJSRBtWSlVZN2qdqz04QKAkx4sOT/7e+3Y6dlMBZHHwy3++ZEpEV5j4vqrQs0UTfchHVNwKaV Fab5EOeR+zAowfJt5ObYskGwfrWjPMW2VtezC/cSRZduoZWINVdXoEoRM61RG8u5YTGo8UR5oyFj Szs/aMuH/g+WTj9fVDnUA1BLAwQUAAAACAA3g1UucIa+QhIBAAC2AQAACAAAAG1haW4uY3h4VVBd S8MwFH3Pr7hkTJJSij7XCdOhL2UbIvgijC4fNJAmNUnFovvvJlnZEEJyOeeee87NQhmmRy4AM9v3 1lQdRosLxrVkGUIoTIPgQsKXVRwIFPvnLVAC+9YJEwqgNULKBOhbZQhFPwhg5mDIT52Qc1kF4QNJ igg9dUpzYOnOLbn615EcCxg2GlbAtR2Eif5Yq6Pv4jheeYtLeH1rNoeXZve4bn5zvd29z3olyVm9 glugCcnpUhwXI0cWL30cwbVwzjpC0zKRPeUd4pqDNGv2OSonYgKSIcq1n/o8twQsR8OCsuYOw+x5 mXwU0kbd8jueDxNdbvKCJQCfTNsrdmCtD/f5F4oHMtNAzxGuzlemRif0B1BLAwQUAAAACAAzh1Uu Li7jbD0AAABQAAAABAAAAGMuc2hL19ZW0E1X0M1XyE3MzAMTeskVFQq6OSk5XOlQyeKMxKLUFAXd 8BwdXVcFkOKczCSIoF5xvgKUBdTGxQUAUEsBAhQAFAAAAAgAL4JVLuBCXoSDAAAAqwAAAAoAAAAA AAAAAQAAALaBAAAAAHNoYXJlZC5jeHhQSwECFAAUAAAACADLglUur4fuEZUAAAA1AQAACAAAAAAA AAABAAAAtoGrAAAAY29tbW9uLmhQSwECFAAUAAAACAA3g1UucIa+QhIBAAC2AQAACAAAAAAAAAAB AAAAtoFmAQAAbWFpbi5jeHhQSwECFAAUAAAACAAzh1UuLi7jbD0AAABQAAAABAAAAAAAAAABAAAA toGeAgAAYy5zaFBLBQYAAAAABAAEANYAAAD9AgAAAAA=
next reply other threads:[~2003-02-22 0:06 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-02-22 0:06 raymond [this message] 2003-02-22 0:32 bangerth 2003-02-24 19:15 bangerth
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20030221235851.24314.qmail@sources.redhat.com \ --to=raymond@cdlsystems.com \ --cc=gcc-gnats@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).