1.
Do not put your code files in SketchUp’s program path. They do not belong there.
All user files, plugins and extensions go in the %AppData% path since version 2014.
2.
Use the ".dll"
extension for the path as Win32API.rb
will try to add it anyway, and you’ll do better to help it along.
3.
The Win32API
class is deprecated (for a long time) and no longer even appears in the current Ruby documentation for the versions used by SketchUp. The old compiled "Win32API.so"
file was (a long time since) replaced with a "Win32API.rb"
file that just made converted calls into other libraries. First into DL
which was later removed. It then was rewritten to make converted calls using the Fiddle
library.
So you might as well learn to use Fiddle
directly.
Yes, the proper place for your code is in an extension specific subfolder of the "Plugins"
folder.
These extension specific subfolders are traditionally prefixed with you author or company namespace identifier, followed by an underscore and the name of the extension.
You cannot just use … "AppData\Roaming\SketchUp\SketchUp 2019\SketchUp\Plugins\dll"
In Ruby you’d need to do …
plugins = "SketchUp/SketchUp 2019/SketchUp/Plugins"
dll_path = File.join( ENV["APPDATA"], plugins, 'ljs_dll_test', 'bcdf.dll')
… OR (even easier) …
plugins = Sketchup.find_support_file('Plugins')
dll_path = File.join( plugins, 'ljs_dll_test', 'bcdf.dll')
Your error indicates that the file was found and an attempt to load it was made but …
Exec format error (LoadError)
Fiddle could open it or more likely could not find the export function named "Message"
.
Ie, …
I looked at the C part of your code and I do NOT see an exported function by the name "Message"
.
I do see one by the name "Example"
.
Also when you post code, please post different languages delimited separately so they can be lexed properly. See …