The problem of ruby load c dll. editor says :'unknown symbol'

(1) Please edit your previous post and properly delimit code blocks for forum posting.

… and please do not post images of code. Cut and paste the code into a delimited code block.


(2) You cannot use the C API to change a live model at this time. You can only read stuff from the model, say for creating an exporter, or building another model file that is not the active model.

The C API was written for 3rd party applications to create importers and exporters for their applications.


(3) You did not properly terminate your code’s use of the API interface.
Please reread the “Quick Start” on this introductory page …
https://extensions.sketchup.com/developers/sketchup_c_api/sketchup/index.html

  // Must release the model or there will be memory leaks
  SUModelRelease(&model);
  // Always terminate the API when done using it
  SUTerminate();
  return 0;

(4) You do not need Fiddle to load a Ruby C extension if you’ve properly defined a Ruby entry point function … ie "Init_SameNameAsDLLfile"

You just use the global require() defined in the Kernel module (which is mixed into Object making it global.) … from the doc for this method (with emphasis by me)

If the filename has the extension “.rb”, it is loaded as a source file; if the extension is “.so”, “.o”, or “.dll”, or the default shared library extension on the current platform, Ruby loads the shared library as a Ruby extension.


(5) The entry point function should define Ruby object to access C functionality. Ie, it should create your module objects (your toplevel namespace module, and it’s extension specific submodule,) and within those define Ruby methods that when called in Ruby, fire off C or C++ functions.


(6) Then please first learn how the SketchUp API works using Ruby scripting. Creating C Ruby extensions is very advanced.