Skip to content

Commit

Permalink
JSI: Minor tweaks for building on MSVC (#23367)
Browse files Browse the repository at this point in the history
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: #23367

Differential Revision: D14032507

Pulled By: cpojer

fbshipit-source-id: 701c13e3509cc244dbe0c15f92067fae4382bee2
  • Loading branch information
empyrical authored and facebook-github-bot committed Feb 11, 2019
1 parent aefb059 commit 78be6ef
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions ReactCommon/jsi/jsi.h
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -14,8 +14,12 @@
#include <vector>

#ifndef JSI_EXPORT
#ifdef _MSC_VER
#define JSI_EXPORT
#else
#define JSI_EXPORT __attribute__((visibility("default")))
#endif
#endif

class FBJSRuntime;
namespace facebook {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 78be6ef

Please sign in to comment.