Hey everyone,
I would like to share SQLite3 C/C++ compiler project that aims to run SQLite3 functions on your extensions natively. We developed this for Speckle SketchUp Connector because we were violating SketchupRequirements/GemInstall by using it as below. And also it was crashing Speckle on SU 2021.
# BAD - before
begin
require("sqlite3")
rescue LoadError
Gem.install(File.join(File.dirname(File.expand_path(__FILE__)), "sqlite3-1.4.2.mspgreg-x64-mingw32.gem"))
require("sqlite3")
end
database = Sqlite3::Database.new(db_path)
# GOOD - after
require 'ext/sqlite3'
database = SpeckleConnector::Sqlite3::Database.new(db_path)
How to build it for your extension?
You can build this project with your extensions’ namespace to use it fluently. Only thing you need to do change top namespace name with your extensions’ name on rbsqlite3.cpp
file.
VALUE speckle_connector = rb_define_module("SpeckleConnector");
Any comment/contribution more than welcome!
Special thanks to @thomthom by providing examples to achieve this!
-OÄźuzhan