Flutter Engine
The Flutter Engine
ffi_test_fields.h
Go to the documentation of this file.
1// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2// for details. All rights reserved. Use of this source code is governed by a
3// BSD-style license that can be found in the LICENSE file.
4#ifndef RUNTIME_BIN_FFI_TEST_FFI_TEST_FIELDS_H_
5#define RUNTIME_BIN_FFI_TEST_FFI_TEST_FIELDS_H_
6
7#include <stdint.h>
8
9#if defined(_WIN32)
10#define DART_EXPORT_FIELD __declspec(dllexport)
11#else
12#define DART_EXPORT_FIELD __attribute__((visibility("default")))
13#endif
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19struct Coord {
20 double x;
21 double y;
22 struct Coord* next;
23};
24
25// These fields and structs are being accessed by @Native Dart variables in
26// tests, so they must be defined with C linkage to avoid name mangling.
27// MSVC doesn't seem to like extern "C" fields in C++ files, so the files are
28// moved into a separate C file.
29extern DART_EXPORT_FIELD int32_t globalInt;
31
32#ifdef __cplusplus
33}
34#endif
35
36#endif // RUNTIME_BIN_FFI_TEST_FFI_TEST_FIELDS_H_
DART_EXPORT_FIELD struct Coord globalStruct
#define DART_EXPORT_FIELD
DART_EXPORT_FIELD int32_t globalInt
double x
struct Coord * next
double y