Error In Build C Extension of SketchUp

Continuing the discussion from Ruby extension and SketchupAPI:

Hello @Rojj ,
I also trying to build the 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/Debug (2.0)/x64
Requiring F:/SketchUpApp/Ruby_c_SketchUp_Extention/Debug (2.0)/x64/
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/>
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 solve this problem

I don’t write to the C API but could it be that you misspelled extension as “extention”?

If the path was incorrect, then the LoadError message would be:
#<LoadError: cannot load such file -- F:/SketchUpApp/Ruby_c_SketchUp_Extention/Debug (2.0)/x64/

Are you sure that the entry point function is correctly named “SUEX_HelloWorld” ?

But My .so file is present at that path still ruby console is give the error.
my question is there any require is required in kernel_require.rb: file

Try to remove the _ character from lib/module name SUEXHelloWorld

yes , EntryPoint Init_SUEX_HelloWorld

That will not work. The filename and the entry point function suffix must match exactly.

Okay, did you compile for Ruby 2.7 ? Ie, … you must compile with Ruby 2.7 to load into SketchUp versions 2021 through 2023.

Also make sure that you have the latest C SDK available.

I have complied my code with ruby 2.7 and I am using visual studio,errors are not there but I am not able to see any extension there? I am using visual studio 2019.

I think that error means that is trying to load a dll, and it can’t find it.

On Windows, I normally use a MSYS2 ucrt exe (objdump) to see what an *.so file is loading…

> cd 'C:\Program Files\SketchUp\SketchUp 2023'
> C:/msys64/ucrt64/bin/objdump.exe -p x64-msvcrt-ruby270.dll | Select-String -Pattern 'DLL Name:' | Sort-Object

        DLL Name: ADVAPI32.dll
        DLL Name: api-ms-win-crt-convert-l1-1-0.dll
        DLL Name: api-ms-win-crt-environment-l1-1-0.dll
        DLL Name: api-ms-win-crt-filesystem-l1-1-0.dll
        DLL Name: api-ms-win-crt-heap-l1-1-0.dll
        DLL Name: api-ms-win-crt-math-l1-1-0.dll
        DLL Name: api-ms-win-crt-runtime-l1-1-0.dll
        DLL Name: api-ms-win-crt-stdio-l1-1-0.dll
        DLL Name: api-ms-win-crt-string-l1-1-0.dll
        DLL Name: api-ms-win-crt-time-l1-1-0.dll
        DLL Name: api-ms-win-crt-utility-l1-1-0.dll
        DLL Name: imagehlp.dll
        DLL Name: IPHLPAPI.DLL
        DLL Name: KERNEL32.dll
        DLL Name: SHELL32.dll
        DLL Name: USER32.dll
        DLL Name: VCRUNTIME140.dll
        DLL Name: WS2_32.dll

I assume that was a stand-alone Ruby? How did you build it, or where did you obtain it from?

I think you need an mswin build, but also with a non-standard file name x64-msvcrt-ruby270.dll. Normally it would be named x64-vcruntime140-ruby270.dll.

EDIT: If you need a stand-alone Ruby, see Releases · MSP-Greg/sketchup-ext-gem · GitHub
the file is I compiled it with VS 2019.

The additional packages (openssl, etc) were built with GitHub - microsoft/vcpkg: C++ Library Manager for Windows, Linux, and MacOS, and located at C:/vcpkg19. I use C:/vcpkg for VS 2022…