From 9cb26831bc27aa24d468e3833779ff2bb0b95b50 Mon Sep 17 00:00:00 2001 From: Braiden Vasco Date: Sun, 13 Sep 2015 10:07:26 +0000 Subject: [PATCH] Check for required Tox ABI version in runtime --- ext/tox/extconf.rb | 1 + ext/tox/tox.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/ext/tox/extconf.rb b/ext/tox/extconf.rb index 0b258bf..cc27b8c 100755 --- a/ext/tox/extconf.rb +++ b/ext/tox/extconf.rb @@ -13,5 +13,6 @@ have_library LIBTOXCORE, 'tox_get_savedata' and have_library LIBTOXCORE, 'tox_self_get_address' and have_library LIBTOXCORE, 'tox_bootstrap' and have_library LIBTOXCORE, 'tox_kill' and +have_library LIBTOXCORE, 'tox_version_is_compatible' and create_makefile "#{NAME}/#{NAME}" or exit(1) diff --git a/ext/tox/tox.c b/ext/tox/tox.c index abbd382..22de2ea 100644 --- a/ext/tox/tox.c +++ b/ext/tox/tox.c @@ -45,6 +45,9 @@ static VALUE cTox_cOptions_data_EQUALS(VALUE self, VALUE data); void Init_tox() { + if (!TOX_VERSION_IS_ABI_COMPATIBLE()) + rb_raise(rb_eLoadError, "incompatible Tox ABI version"); + cTox = rb_define_class("Tox", rb_cObject); rb_define_alloc_func(cTox, cTox_alloc); rb_define_method(cTox, "initialize_with", cTox_initialize_with, 1);