What is Nostr?
shac ron ₪‎ /
npub1vmt…rx56
2024-09-15 07:59:02

shac ron ₪‎ on Nostr: Alright, here’s what I want. A compiler annotation for class methods that create a ...

Alright, here’s what I want. A compiler annotation for class methods that create a C symbol that takes the same arguments and the ‘this’ pointer equivalent as the first arg.

class Foo {
public:
int value() __attribute__((c_linkage, foo_get_value));
// …
};

This defines
external “C” int foo_get_value(Foo *this)
and tags it for the linker.

If the linker is smart, it will create a C++ style call at call sites, putting ‘this’ in the proper register. If it’s dumb, it will call the stub emitted by the compiler that trivially does this. https://ioc.exchange/@shac/113132207933183105
Author Public Key
npub1vmtnnusyhm9gchr0w0m8p52w5mjv4kv4a7n5xqd9hhucqunjy8pq8arx56