New in Xcode 4 : Local var in C function has "protected destructor" ?!?
New in Xcode 4 : Local var in C function has "protected destructor" ?!?
- Subject: New in Xcode 4 : Local var in C function has "protected destructor" ?!?
- From: Jerry Krinock <email@hidden>
- Date: Sat, 04 Aug 2012 23:28:51 -0700
A project includes a dynamic library which is called by JavaScript in my Firefox extension, via Mozilla's "CTypes" bridge. One of its functions needs to talk C++ (and Obj-C), so I put it in a .mm "shim" file. Also, CTypes requires that functions be declared externally as pure "C", not C++, so I wrap it in an 'extern "C"' block. This also avoids name mangling. [1]
All worked fine in Xcode 3. But when I try to build the project in Xcode 4, an error occurs in this file at the *declaration* of a local variable, because it "has a protected destructor". This makes no sense to me at all. It's not even in a C++ class. What in the world might be going on?
Thanks,
Jerry Krinock
******* SSYFirefoxCToCppShim.h *******
#ifdef __cplusplus
extern "C" {
#endif
void ProcessClientRequest(
char headerByte,
NSData* data,
char* responseHeaderByte_p,
NSData** payload_p
) ;
#ifdef __cplusplus
}
#endif
******* SSYFirefoxCToCppShim.mm *******
extern "C" {
void ProcessClientRequest(
char headerByte,
NSData* data,
char* responseHeaderByte_p,
NSData** payload_p
) {
...
nsACString nsacString ;
// !!!!!!!!!!!!!!! ERROR ON PRECEDING LINE: !!!!!!!!!!!!!!!
// "Variable of type 'nsACString' has protected destructor."
if (ourJavascriptComponent != NULL) {
switch (headerByte) {
case constInterappHeaderByteForGrabRequest:
// Note that nsacString is an *output* parameter from SsyJsGrabPage
jsonText = [[NSString alloc] initWithBytes:nsacString.BeginReading()
length:nsacString.Length()
encoding:NSUTF8StringEncoding] ;
...
break ;
case …
case …
case …
default:
;
}
}
...
}
}
[1] http://stackoverflow.com/questions/4506487/how-to-unmangle-exported-symbols-from-c-in-dynamic-libraries-in-xcode-on-osx
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden