Skip to content

Commit

Permalink
[unity]修正Log接口移动后window的报错
Browse files Browse the repository at this point in the history
  • Loading branch information
chexiongsheng committed Mar 25, 2024
1 parent 18f08c8 commit c1723d4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
4 changes: 3 additions & 1 deletion unity/native_src/Inc/Log.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
#pragma once

#include <string>
#include "Common.h"
#include "Common.h"

typedef void(*LogCallback)(const char* value);

namespace PUERTS_NAMESPACE
{
Expand Down
8 changes: 3 additions & 5 deletions unity/native_src/Src/Log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@
#include <stdarg.h>
#include "Common.h"

typedef void(*LogCallback)(const char* value);

LogCallback GLogCallback = nullptr;
LogCallback GLogWarningCallback = nullptr;
LogCallback GLogErrorCallback = nullptr;
extern LogCallback GLogCallback;
extern LogCallback GLogWarningCallback;
extern LogCallback GLogErrorCallback;

namespace PUERTS_NAMESPACE
{
Expand Down
11 changes: 5 additions & 6 deletions unity/native_src/Src/Puerts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "JSEngine.h"
#include <cstring>
#include "V8Utils.h"
#include "Log.h"

#define API_LEVEL 33

Expand All @@ -18,6 +19,10 @@ using puerts::FV8Utils;
using puerts::FLifeCycleInfo;
using puerts::JsValueType;

LogCallback GLogCallback = nullptr;
LogCallback GLogWarningCallback = nullptr;
LogCallback GLogErrorCallback = nullptr;

#ifdef __cplusplus
extern "C" {
#endif
Expand Down Expand Up @@ -973,12 +978,6 @@ V8_EXPORT void LogicTick(v8::Isolate *Isolate)
return JsEngine->LogicTick();
}

typedef void(*LogCallback)(const char* value);

extern LogCallback GLogCallback;
extern LogCallback GLogWarningCallback;
extern LogCallback GLogErrorCallback;

V8_EXPORT void SetLogCallback(LogCallback Log, LogCallback LogWarning, LogCallback LogError)
{
GLogCallback = Log;
Expand Down

0 comments on commit c1723d4

Please sign in to comment.