我已经开发了 sqlite包装器,用于使用C ++ 的React Native。使其工作的最简单方法是将SQLite合并包含在来源中。但是,这大大增加了捆绑包的大小。因此,我想为用户提供使用手机嵌入式SQLite版本的选项。
iOS版本正在起作用(我排除了源存在环境国旗)。但是,Android似乎更为复杂。我在Google上找到的大多数答案建议使用合并路径。但是,似乎可以使用手机的SQLite版本(默认情况下使用NDK)。
我目前正在编译。
我是一个Android Noobie,有人会像我5一样解释它,如何从我的NDK C ++代码链接/访问SQLite标头?也许我应该离开 sqlite.h
标题文件,它将与手机的版本链接?
编辑1:似乎只剩下标头文件,不起作用。我还遇到了此 hacker新闻线程。一些评论似乎表明,从NDK代码中访问诸如curl/sqlite/etc之类的东西并不可能。有什么想法吗?
多谢!
编辑2:我找到了一个可能起作用的链接,该链接
I've developed a SQLite wrapper for React Native using C++. The easiest way to get it working was to include the SQLite amalgamation in the sources. This however increases the bundle size significantly. So I want to give the users the option to use the phone's embedded SQLite version.
The iOS version is working (I exclude the sources if an environment flag is present). Android seems a lot more complicated though. Most of the answers I find on google recommend using the amalgamation path. It seems however it is possible to use the phone's SQLite version (it comes by default with the NDK).
I'm currently compiling the amalgamation via CMake.
I'm an Android noobie, would someone explain it like I'm 5 how can I link/access the SQLite headers from my NDK C++ code? Maybe I should just leave the sqlite.h
header file and it will link with the phone's version?
EDIT 1: It seems leaving the header file only, does not work. I've also ran into this Hacker News thread. Some of the comments seem to suggest it is not really possible to access things like curl/sqlite/etc from the NDK code. Any thoughts?
Thanks a lot!
Edit 2: I found a link that might work https://blog.katastros.com/a?ID=00200-fd6cd935-b779-4f44-9b4c-efad582167e1
发布评论
评论(1)
经过很多困扰,我得出结论,无法通过C ++实现链接手机SQLITE的方法。因此,最好的是,旧的Android版本具有过时的版本,供应商还修改了运行的SQLite版本,并且充满了旧的错误和破碎的东西。
After much fumbling around I've come to the conclusion there is no way to achieve linking the phones sqlite via c++. It is also probably best so, old android versions have outdated versions, vendors also modify the running sqlite versions and they are full of old bugs and broken stuff.