|
From: | Ivan Vučica |
Subject: | Re: error compiling GUI - string constants |
Date: | Fri, 28 Jul 2017 13:16:45 +0100 |
On 27 Jul 2017, at 17:06, Fred Kiefer <address@hidden> wrote:
>
>>
>> Am 27.07.2017 um 10:26 schrieb David Chisnall <address@hidden>:
>>
>> On 26 Jul 2017, at 14:58, Josh Freeman <address@hiddencom > wrote:
>>> #if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST) I thought that GCC had an attribute for it, but apparently not. The following works on ELF platforms, at least, and there are equivalents for Mach-O:
>>> # define NSPasteboardTypeString NSStringPboardType
>>> #endif
>>
>> Am I missing something? Why not simply make the first symbol an alias for the second?
>
>
> David, what do you mean by alias?
#include <stdio.h>
int x;
extern int y;
asm (".weakref y, x");
int main(void)
{
y = 0;
x = 42;
// Prints 42
printf(“%d\n”, y);
}
So this would work for our use:
extern NSPasteboardTypeString;
asm(".weakref NSPasteboardTypeString NSStringPboardType");
We’d end up in the linked binary with a single location with two symbol names.
David
alias ("
target")
alias
attribute causes the declaration to be emitted as an alias for another symbol, which must be specified. For instance, void __f () { /* Do something. */; }
void f () __attribute__ ((weak, alias ("__f")));
declares `f' to be a weak alias for `__f'. In C++, the mangled name for the target must be used.
Not all target machines support this attribute.
[Prev in Thread] | Current Thread | [Next in Thread] |