From 78be6efda97096e8388af5bf2dadb9c9de4fa0ba Mon Sep 17 00:00:00 2001 From: empyrical Date: Mon, 11 Feb 2019 15:37:00 -0800 Subject: [PATCH] JSI: Minor tweaks for building on MSVC (#23367) Summary: This pull request makes two minor changes to `jsi.h`: * Tweak the `JSI_EXPORT` macro to automatically set itself to an empty value if `_MSC_VER` is defined - like how was done by acoates-ms [here](https://github.com/facebook/react-native/blob/8beb4bb58ab93af8c95af6844230d62c85ccab78/ReactCommon/cxxreact/JSBigString.h#L15-L21). * Tweak the call to constructor `Pointer(Runtime::PointerValue* ptr)` in the constructor for `PropNameID`. I am not sure why MSVC wasn't working with the original version, but it compiles after I tweak that. [General] [Fixed] - Tweaked `jsi.h` to build on MSVC Pull Request resolved: https://github.com/facebook/react-native/pull/23367 Differential Revision: D14032507 Pulled By: cpojer fbshipit-source-id: 701c13e3509cc244dbe0c15f92067fae4382bee2 --- ReactCommon/jsi/jsi.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ReactCommon/jsi/jsi.h b/ReactCommon/jsi/jsi.h index 5d01456fe..405c3cc1b 100644 --- a/ReactCommon/jsi/jsi.h +++ b/ReactCommon/jsi/jsi.h @@ -1,7 +1,7 @@ // Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the - // LICENSE file in the root directory of this source tree. +// LICENSE file in the root directory of this source tree. #pragma once @@ -14,8 +14,12 @@ #include #ifndef JSI_EXPORT +#ifdef _MSC_VER +#define JSI_EXPORT +#else #define JSI_EXPORT __attribute__((visibility("default"))) #endif +#endif class FBJSRuntime; namespace facebook { @@ -300,8 +304,8 @@ class PropNameID : public Pointer { public: using Pointer::Pointer; - PropNameID(Runtime& runtime, const PropNameID& other) - : PropNameID(runtime.clonePropNameID(other.ptr_)) {} + PropNameID(Runtime &runtime, const PropNameID &other) + : Pointer(runtime.clonePropNameID(other.ptr_)) {} PropNameID(PropNameID&& other) = default; PropNameID& operator=(PropNameID&& other) = default;