Skip to content

Commit 72d6640

Browse files
committed
Move other global pointers
1 parent a8c8c3e commit 72d6640

5 files changed

Lines changed: 30 additions & 12 deletions

File tree

mypyc/lib-rt/base64/librt_base64.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#define LIBRT_BASE64_API_VERSION 2
88
#define LIBRT_BASE64_API_LEN 4
99

10-
static void *LibRTBase64_API[LIBRT_BASE64_API_LEN];
10+
extern void *LibRTBase64_API[LIBRT_BASE64_API_LEN];
1111

1212
#define LibRTBase64_ABIVersion (*(int (*)(void)) LibRTBase64_API[0])
1313
#define LibRTBase64_APIVersion (*(int (*)(void)) LibRTBase64_API[1])

mypyc/lib-rt/internal/librt_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static int NativeInternal_API_Version(void);
4444

4545
#else
4646

47-
static void *NativeInternal_API[LIBRT_INTERNAL_API_LEN];
47+
extern void *NativeInternal_API[LIBRT_INTERNAL_API_LEN];
4848

4949
#define ReadBuffer_internal (*(PyObject* (*)(PyObject *source)) NativeInternal_API[0])
5050
#define WriteBuffer_internal (*(PyObject* (*)(void)) NativeInternal_API[1])

mypyc/lib-rt/static_data.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
#ifndef STATIC_DATA
22
#define STATIC_DATA
33

4+
#include "CPy.h"
45
#include "static_data.h"
6+
#include "base64/librt_base64.h"
7+
#include "internal/librt_internal.h"
58
#include "strings/librt_strings.h"
9+
#include "time/librt_time.h"
10+
#include "vecs/librt_vecs.h"
611

712
// Adopted from numpy 2.4.0: numpy/_core/src/multiarry/npy_static_data.c
813

@@ -76,7 +81,20 @@ intern_strings(void) {
7681
#ifdef MYPYC_EXPERIMENTAL
7782

7883
void *LibRTStrings_API[LIBRT_STRINGS_API_LEN] = {0};
84+
void *LibRTTime_API[LIBRT_TIME_API_LEN] = {0};
85+
VecCapsule *VecApi = NULL;
86+
VecI64API VecI64Api = {0};
87+
VecI32API VecI32Api = {0};
88+
VecI16API VecI16Api = {0};
89+
VecU8API VecU8Api = {0};
90+
VecFloatAPI VecFloatApi = {0};
91+
VecBoolAPI VecBoolApi = {0};
92+
VecTAPI VecTApi = {0};
93+
VecNestedAPI VecNestedApi = {0};
7994

8095
#endif // MYPYC_EXPERIMENTAL
8196

97+
void *LibRTBase64_API[LIBRT_BASE64_API_LEN] = {0};
98+
void *NativeInternal_API[LIBRT_INTERNAL_API_LEN] = {0};
99+
82100
#endif

mypyc/lib-rt/time/librt_time.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import_librt_time(void)
1818
#define LIBRT_TIME_API_VERSION 1
1919
#define LIBRT_TIME_API_LEN 3
2020

21-
static void *LibRTTime_API[LIBRT_TIME_API_LEN];
21+
extern void *LibRTTime_API[LIBRT_TIME_API_LEN];
2222

2323
#define LibRTTime_ABIVersion (*(int (*)(void)) LibRTTime_API[0])
2424
#define LibRTTime_APIVersion (*(int (*)(void)) LibRTTime_API[1])

mypyc/lib-rt/vecs/librt_vecs.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -847,15 +847,15 @@ PyObject *Vec_GenericPopWrapper(Py_ssize_t *len, PyObject **items, PyObject *arg
847847
PyObject *Vec_GenericPop(Py_ssize_t *len, PyObject **items, Py_ssize_t index);
848848

849849
// Global API pointers initialized by import_librt_vecs()
850-
static VecCapsule *VecApi;
851-
static VecI64API VecI64Api;
852-
static VecI32API VecI32Api;
853-
static VecI16API VecI16Api;
854-
static VecU8API VecU8Api;
855-
static VecFloatAPI VecFloatApi;
856-
static VecBoolAPI VecBoolApi;
857-
static VecTAPI VecTApi;
858-
static VecNestedAPI VecNestedApi;
850+
extern VecCapsule *VecApi;
851+
extern VecI64API VecI64Api;
852+
extern VecI32API VecI32Api;
853+
extern VecI16API VecI16Api;
854+
extern VecU8API VecU8Api;
855+
extern VecFloatAPI VecFloatApi;
856+
extern VecBoolAPI VecBoolApi;
857+
extern VecTAPI VecTApi;
858+
extern VecNestedAPI VecNestedApi;
859859

860860
static int
861861
import_librt_vecs(void)

0 commit comments

Comments
 (0)