external relocation entries in non-writable section?

Anders F Björklund afb at algonet.se
Tue Jan 30 12:58:53 PST 2007


Rick Mann wrote:

> /usr/bin/ld: ../../target/lib/libdarbonapi.a(CFString.d.o) has external relocation entries in non-writable section (__TEXT,__text) for symbols:
> ___CFStringMakeConstantString
> 
> I'm not sure what this error message means (does it have to do with packaging it all in a static library? Don't see why...). In the library I've created, one of my modules (CFString.d) has this:
> 
> struct __CFString {};
> typedef const __CFString*				CFStringRef;
> 
> extern (C)
> CFStringRef
> __CFStringMakeConstantString(char* cStr);
> 
> Other symbols seem to link just fine. I'm not sure what's different about this one.

Maybe it has something to do with that extra "const" ? What is that ?
(looks to me like it is trying to use the keyword like it was in C++)

Although when I tried it, it still worked OK even with the "const"...

struct __CFString { } // opaque
typedef const __CFString* CFStringRef;

extern(C) CFStringRef __CFStringMakeConstantString(char *cStr);
alias __CFStringMakeConstantString CFSTR; // only for string literals


Then using it something like:

     err = CreateNibReference(CFSTR("main"), &nibRef);
     if (err != noErr) goto CantGetNibRef;

So I'm not sure what else your code is doing differently than mine ?

--anders


More information about the Digitalmars-d-learn mailing list