mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-07 04:23:41 +00:00
cgo: only include the symbols that are necessary (recursively)
Only try to convert the C symbols to their Go equivalents that are actually referenced by the Go code with C.<somesymbol>. This avoids having to support all possible C types, which is difficult because of oddities like `typedef void` or `__builtin_va_list`. Especially __builtin_va_list, which varies between targets.
This commit is contained in:
committed by
Ron Evans
parent
35af33ead7
commit
b1ed8a46b7
Vendored
+6
@@ -2,12 +2,17 @@
|
||||
#include <stdint.h>
|
||||
|
||||
typedef short myint;
|
||||
typedef short unusedTypedef;
|
||||
int add(int a, int b);
|
||||
int unusedFunction(void);
|
||||
typedef int (*binop_t) (int, int);
|
||||
int doCallback(int a, int b, binop_t cb);
|
||||
typedef int * intPointer;
|
||||
void store(int value, int *ptr);
|
||||
|
||||
// this signature should not be included by CGo
|
||||
void unusedFunction2(int x, __builtin_va_list args);
|
||||
|
||||
typedef struct collection {
|
||||
short s;
|
||||
long l;
|
||||
@@ -37,6 +42,7 @@ void unionSetData(short f0, short f1, short f2);
|
||||
|
||||
// test globals and datatypes
|
||||
extern int global;
|
||||
extern int unusedGlobal;
|
||||
extern bool globalBool;
|
||||
extern bool globalBool2;
|
||||
extern float globalFloat;
|
||||
|
||||
Reference in New Issue
Block a user