discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Crash occurs when catching std::exception in Objective-C++ code comp


From: David Chisnall
Subject: Re: Crash occurs when catching std::exception in Objective-C++ code compiled with clang on Linux and using libobjc2
Date: Mon, 20 Nov 2017 19:21:55 +0000

On 20 Nov 2017, at 19:15, Lobron, David <dlobron@akamai.com> wrote:
> 
> One more bit of info on the linker error on my .mm test program: I confirmed 
> that libobjc.so has the symbols, e.g.,
> 
> (ALSI8)dlobron@bos-lps80:~/build/clangport/akamai/common/lib$ nm -C 
> libobjc.so|grep objc_autorelease
> 00000000000204b0 T objc_autorelease
> 00000000000200f0 T objc_autoreleasePoolPop
> 000000000001fc90 T objc_autoreleasePoolPush
> 00000000000204f0 T objc_autoreleaseReturnValue 
> 
> I'm linking with the library:
> 
> /home/dlobron/build/clangport/akamai/llvm/llvm-5.0.0.install/bin/clang 
> -std=gnu99  -fexceptions  -rdynamic 
> CMakeFiles/CXXException.dir/CXXException.mm.o  -o CXXException 
> -Wl,-rpath,/home/dlobron/build/clangport/akamai/libobjc2/libobjc2-1.8.1/build 
> ../libobjc.so.4.6 -lstdc++ ../libobjcxx.so.4.6 
> -L/home/dlobron/build/clangport/akamai/common/lib -lobjcxx -lobjc
> 
> But the symbol is still not found:
> 
> CMakeFiles/CXXException.dir/CXXException.mm.o: In function 
> `_i_Test__autorelease':
> /home/dlobron/build/clangport/akamai/libobjc2/libobjc2-1.8.1/Test/CXXException.mm:(.text+0x98):
>  undefined reference to `objc_autorelease(objc_object*)’

This looks like it’s trying to all a version with C++ name mangling.  Try 
sticking an extern “C” { } around the #includes.

David




reply via email to

[Prev in Thread] Current Thread [Next in Thread]