Ruby extension and SketchupAPI

I managed to build the basic Hello World ruby extension from Github with XCode 7.2.1

Now I would like to add some of the functions from SketchupAPI and to do this I have initially included the headers

#include "RubyUtils/RubyUtils.h"
#include <iostream>
#include <assert.h>
#include <SketchUpAPI/common.h>
#include <SketchUpAPI/model/material.h>
#include <SketchUpAPI/color.h>
#include <SketchUpAPI/geometry.h>
#include <SketchUpAPI/initialize.h>
#include <SketchUpAPI/unicodestring.h>
#include <SketchUpAPI/model/model.h>
#include <SketchUpAPI/model/entities.h>
#include <SketchUpAPI/model/face.h>
#include <SketchUpAPI/model/edge.h>
#include <SketchUpAPI/model/vertex.h>
#include <vector>

VALUE hello_world() {
  return GetRubyInterface("Hello World!");
}

// Load this module from Ruby using:
//   require 'SUEX_HelloWorld'
extern "C"
void Init_SUEX()
{
  VALUE mSUEX = rb_define_module("SUEX");
  rb_define_const(mSUEX, "CEXT_VERSION", GetRubyInterface("1.0.0"));
  rb_define_module_function(mSUEX, "hello_world",
    VALUEFUNC(hello_world), 0); 
}

The project builds successfully, I copy the three files in my plugin folder …/Plugins/RG/SUEX

Frameworks/Ruby.framework
Frameworks/SketchUpAPI.framework
SUEX.bundle 

but when I require it with require "RG/SUEX/SUEX.bundle" I get the error

Error: #<LoadError: dlopen(/Users/ruggiero/Library/Application Support/SketchUp 2015/SketchUp/Plugins/RG/SUEX/SUEX.bundle, 9): Library not loaded: @rpath/SketchUpAPI.framework/Versions/Current/SketchUpAPI
  Referenced from: /Users/ruggiero/Library/Application Support/SketchUp 2015/SketchUp/Plugins/RG/SUEX/SUEX.bundle
  Reason: image not found - /Users/ruggiero/Library/Application Support/SketchUp 2015/SketchUp/Plugins/RG/SUEX/SUEX.bundle>
/Applications/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/2.0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
/Applications/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/2.0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
<main>:in `<main>'
SketchUp:1:in `eval'

I think the problem is related to the search path but I cannot figure out how to fix it. Any idea?

Any hint on how I can fix the problem above? Is it actually possible to use the Sketchup C API from Ruby to build extensions that work on the current model?

Thanks

Continuing the discussion from Ruby extension and SketchupAPI:

Hello @Rojj ,
I also trying to build above same Hello world code from github at my end but I’m getting error in ruby console:

SketchUp Pro 23.0.419
Loading 'Debug (2.0)' (x64) build...
F:/SketchUpApp/Ruby_c_SketchUp_Extention/Ruby
F:/SketchUpApp/Ruby_c_SketchUp_Extention
F:/SketchUpApp/Ruby_c_SketchUp_Extention/Debug (2.0)/x64
Requiring F:/SketchUpApp/Ruby_c_SketchUp_Extention/Debug (2.0)/x64/SUEX_HelloWorld.so
File load error (F:\SketchUpApp\Ruby_c_SketchUp_Extention\Ruby\launch_sketchup.rb): 
Error: #<LoadError: 126: The specified module could not be found.   - F:/SketchUpApp/Ruby_c_SketchUp_Extention/Debug (2.0)/x64/SUEX_HelloWorld.so>
C:/Program Files/SketchUp/SketchUp 2023/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:83:in `require'
C:/Program Files/SketchUp/SketchUp 2023/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:83:in `require'
F:/SketchUpApp/Ruby_c_SketchUp_Extention/Ruby/launch_sketchup.rb:28:in `block in <top (required)>'
F:/SketchUpApp/Ruby_c_SketchUp_Extention/Ruby/launch_sketchup.rb:26:in `each'
F:/SketchUpApp/Ruby_c_SketchUp_Extention/Ruby/launch_sketchup.rb:26:in `<top (required)>'
Im using visual studio 2019 Professional and please help me to solve this problem