Ruby Ruby C 扩展问题 dlsym (已解决。。。)

catfish23 · August 14, 2018 · Last by catfish23 replied at August 15, 2018 · 954 hits
#include <ruby.h>

    VALUE plus(VALUE self, VALUE va, VALUE vb)

    {

        int a = NUM2INT(va);
        int b = NUM2INT(vb);
        return INT2NUM(a+b);

    }

  extern "C" void Init_test(){
   VALUE lemon = rb_define_module("Test");
   rb_define_module_function(lemon, "plus", RUBY_METHOD_FUNC(plus),2);
  }


操作系统 MacOs

Ruby 版本 2.3.4

目前无法 require,错误信息为,按照 opencv 的 cpp 格式修改也不行,不知道原因在哪里 require': dlsym(0x7fd0ae7881f0, Init_Test): symbol not found

catfish23 closed this topic. 15 Aug 15:30
catfish23 reopened this topic. 15 Aug 15:30
catfish23 reopened this topic. 15 Aug 15:30
catfish23 closed this topic. 15 Aug 16:04
You need to Sign in before reply, if you don't have an account, please Sign up first.