Commit 3a131a51 authored by Kirill Smelkov's avatar Kirill Smelkov

libgolang: Export _runtime internally

Package os will need to access runtime operations to implement IO.

/reviewed-on !17
parent 3a838d24
...@@ -5,6 +5,7 @@ include golang/runtime/libpyxruntime.cpp ...@@ -5,6 +5,7 @@ include golang/runtime/libpyxruntime.cpp
include golang/pyx/runtime.h include golang/pyx/runtime.h
include golang/pyx/runtime.cpp include golang/pyx/runtime.cpp
include golang/pyx/testprog/golang_dso_user/dsouser/dso.cpp include golang/pyx/testprog/golang_dso_user/dsouser/dso.cpp
include golang/runtime/internal.h
include golang/context.h include golang/context.h
include golang/context.cpp include golang/context.cpp
include golang/cxx.h include golang/cxx.h
......
...@@ -173,6 +173,7 @@ def _with_build_defaults(kw): # -> (pygo, kw') ...@@ -173,6 +173,7 @@ def _with_build_defaults(kw): # -> (pygo, kw')
dependv = kw.get('depends', [])[:] dependv = kw.get('depends', [])[:]
dependv.extend(['%s/golang/%s' % (pygo, _) for _ in [ dependv.extend(['%s/golang/%s' % (pygo, _) for _ in [
'libgolang.h', 'libgolang.h',
'runtime/internal.h',
'context.h', 'context.h',
'cxx.h', 'cxx.h',
'errors.h', 'errors.h',
......
#ifndef _NXD_LIBGOLANG_RUNTIME_INTERNAL_H
#define _NXD_LIBGOLANG_RUNTIME_INTERNAL_H
// Copyright (C) 2021-2022 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
//
// This program is free software: you can Use, Study, Modify and Redistribute
// it under the terms of the GNU General Public License version 3, or (at your
// option) any later version, as published by the Free Software Foundation.
//
// You can also Link and Combine this program with other software covered by
// the terms of any of the Free Software licenses or any of the Open Source
// Initiative approved licenses and Convey the resulting work. Corresponding
// source of such a combination shall include the source code for all other
// software used.
//
// This program is distributed WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options.
// Header runtime/internal.h is used internally by libgolang.
#include <golang/libgolang.h>
// golang::internal::
namespace golang {
namespace internal {
extern const _libgolang_runtime_ops* _runtime;
}} // golang::internal::
#endif // _NXD_LIBGOLANG_RUNTIME_INTERNAL_H
// Copyright (C) 2018-2020 Nexedi SA and Contributors. // Copyright (C) 2018-2022 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com> // Kirill Smelkov <kirr@nexedi.com>
// //
// This program is free software: you can Use, Study, Modify and Redistribute // This program is free software: you can Use, Study, Modify and Redistribute
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
// - because Cython (currently ?) does not allow to add methods to `cdef struct`. // - because Cython (currently ?) does not allow to add methods to `cdef struct`.
#include "golang/libgolang.h" #include "golang/libgolang.h"
#include "golang/runtime/internal.h"
#include "golang/sync.h" #include "golang/sync.h"
#include "golang/time.h" #include "golang/time.h"
...@@ -112,7 +113,10 @@ struct Bug : exception { ...@@ -112,7 +113,10 @@ struct Bug : exception {
// ---- runtime ---- // ---- runtime ----
// initially nil to crash if runtime was not initialized // initially nil to crash if runtime was not initialized
static const _libgolang_runtime_ops *_runtime = nil; namespace internal {
const _libgolang_runtime_ops *_runtime = nil;
}
using internal::_runtime;
void _libgolang_init(const _libgolang_runtime_ops *runtime_ops) { void _libgolang_init(const _libgolang_runtime_ops *runtime_ops) {
if (_runtime != nil) // XXX better check atomically if (_runtime != nil) // XXX better check atomically
......
...@@ -206,6 +206,7 @@ setup( ...@@ -206,6 +206,7 @@ setup(
'golang/time.cpp'], 'golang/time.cpp'],
depends = [ depends = [
'golang/libgolang.h', 'golang/libgolang.h',
'golang/runtime/internal.h',
'golang/context.h', 'golang/context.h',
'golang/cxx.h', 'golang/cxx.h',
'golang/errors.h', 'golang/errors.h',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment