-
Notifications
You must be signed in to change notification settings - Fork 7
Closed
Labels
bindgenBinding generatorBinding generator
Milestone
Description
Certain symbols in the standard C library is exposed under the expected names using a #define
rather than an extern
global variable, e.g. stdin
from stdio.h
:
extern FILE *__stdinp;
// ...
#define stdin __stdinp
The way this is handled in Scala Native is to generate a C function which simply returns the expected symbol, e.g.:
void *scalanative_libc_stdin() { return stdin; }
which is then bound using
@extern
object stdio {
// ...
@name("scalanative_libc_stdin")
def stdin: Ptr[FILE] = extern
}
The questions is should the binding generator handle this case by generating C code or should it generate per platform bindings that use the final symbol, e.g.:
@extern
object stdio {
// ...
@name("__stdinp")
def stdin: Ptr[FILE] = extern
}
Metadata
Metadata
Assignees
Labels
bindgenBinding generatorBinding generator