@dan rathbun said:
Yes. DL is Ruby bridge to using dynamic compiled libraries.
On PC, before DL, we had to use the Win32API library.
Interesting topic 👍
What about the win32-api 1.4.8 by Daniel J. Berger, Park Heesob?
In dl you load the dll file once and then extern as many functions.
<span class="syntaxdefault">dlload</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">find_support_file</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"NewtonServer3.dll"</span><span class="syntaxkeyword">,</span><span class="syntaxstring">"plugins\\SketchyPhysics3\\"</span><span class="syntaxkeyword">))<br /></span><span class="syntaxdefault">extern </span><span class="syntaxstring">"void init()"<br /></span><span class="syntaxdefault">extern </span><span class="syntaxstring">"void stop()"<br /></span><span class="syntaxdefault">extern </span><span class="syntaxstring">"void update(int)"<br /></span><span class="syntaxcomment">#...<br /></span><span class="syntaxdefault"> </span>
But, in win32api.so and win32-api you load the library every time you create a function, right?
<span class="syntaxdefault">api </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> AMS</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Win32</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">API<br />newton </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> File</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">join</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">dir</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">'lib/Win32/newton.dll'</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> <br />Create </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> api</span><span class="syntaxkeyword">.new(</span><span class="syntaxstring">'NewtonCreate'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">'PP'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">'P'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> newton</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">Destroy </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> api</span><span class="syntaxkeyword">.new(</span><span class="syntaxstring">'NewtonDestroy'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">'P'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">'V'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> newton</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">Update </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> api</span><span class="syntaxkeyword">.new(</span><span class="syntaxstring">'Update'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">'P'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxstring">'V'</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> newton</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> </span>
Am I thinking right? Which one is better dl or win32-api?