Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

在 Windows 上构建 rime_console.exe 的方法 #479

Closed
yume-chan opened this issue Aug 12, 2021 · 7 comments
Closed

在 Windows 上构建 rime_console.exe 的方法 #479

yume-chan opened this issue Aug 12, 2021 · 7 comments

Comments

@yume-chan
Copy link

想要构建 rime_console.exe 进行测试,但是看到代码注释说由于 MSVC 不会 export 所有 symbol 而无法构建

# msvc doesn't export all symbols

研究了下发现 CMake 提供了 CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS 这个变量来解决这个问题。


if(BUILD_SHARED_LIBS)

实测只要在这行下方添加

  set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)

并且在 rime_console.cc 顶部添加 #define RIME_IMPORTS 1 即可进行构建(不添加的话 MSVC 不会 import DLL 里的变量,只 import 方法,导致找不到 rime::kDefaultModules)。

rime_deployer.exe 同理。而 rime_dict_manager.exe 则无需上述 preprocessor 即可构建。


缺点是构建的 rime.dll 体积由 2537KB 增长到 3391KB (+33%),或许可以作为一个选项供需要的人使用。

@Ace-Who
Copy link
Contributor

Ace-Who commented Aug 13, 2021

rime_console 的用途用法,有文档吗?

@yume-chan
Copy link
Author

@Ace-Who rime_api_console 主要是展示如何使用 Rime API,而 rime_console 是直接调用 Rime 内部的组件,都是 demo,没有文档

@lotem
Copy link
Member

lotem commented Aug 14, 2021

高明

@hyaray
Copy link

hyaray commented Dec 20, 2021

@Ace-Who rime_api_console 主要是展示如何使用 Rime API,而 rime_console 是直接调用 Rime 内部的组件,都是 demo,没有文档

我想获取当前是否可输入状态,如果是可输入状态,想知道光标所在的坐标,
需要专门编译rime_console才可以和小狼毫通信吗??有没有示例呢,非常感谢!!

@yume-chan
Copy link
Author

需要专门编译 rime_console 才可以和小狼毫通信吗?

rime_console 是个独立的,调用 librime API 的示例应用。你想和小狼毫通信的话,你需要研究小狼毫本身有没有提供某种接口,或者小狼毫和 librime 通信的方式是否允许你同时连接到同一个 librime,建议你到小狼毫的 issue tracker 里问下。

@sbxlmdsl
Copy link

我试了一下,Windows下,rime_console可以这样构建成功,但是参照类似的方法#define RIME_IMPORTS 1 构建rime_deployer还是不行,出现了错误:unresolved external symbol "char const * * rime::kDeployerModules"。

@eagleoflqj
Copy link
Member

Fixed by #700

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants