Hello,

To do what you want, there are 3 options:
- using NativeBoost
- using FFI from the VM
- compiling your dll as part of the vm (VM plugin)

NativeBoost is clearly the best option because it is the fastest, it is
mostly implemented in the image so you can look at the code and it is by
default in the image.

FFI from the VM typically manages much better callbacks, so if you plan to
extensively use callbacks you should look at it, by loading the package of
Aliens (It does not rely any more on the old implementation of aliens but
still have the same image side API and library). Alternatively you can
improve NativeBoost so it manages better call back, this is "easy" as it is
mostly implemented in the image.

Compiling your dll as a VM plugin is usually not the best option, but it
can be useful in some situation (uncommon OS or uncommon hardware for
example).

I explained how to compile and bind a dll with NativeBoost here
(subsection Implementing the FFI calls) :
http://clementbera.wordpress.com/2013/06/19/optimizing-pharo-to-c-speed-with-nativeboost-ffi/
It is a very basic but very simple example.

Additional examples can be found in the class NBBasicExamples in the
package NativeBoost-Examples.
There are also tests (For example NBFFICallbackTests>>#benchQSort) that you
can look at, they work and show how to use NativeBoost.

Else there is the chapter in Pharo for the entrerprise. Other people will
give you a link.



2014-05-29 16:15 GMT+02:00 Bob Williams <rwilliam...@cox.net>:

>  I found an old Smalltalk/V imagine from 2000 and tracked down how I was
> able add calls to Windows DLLs and to add my own. It was in the class
> DynamicLinkLibrary and its subclasses, e. g., a call to the GDIDLL to draw
> a Bezier spline (which I believe I added) was:
>
> bezierTo: hDC lpPoints: anLPPOINT count: anInt
>
>     <api: PolyBezierTo ulong struct ulong boolean>
>
>     ^self invalidArgument
>
>
>
> I added by own DLL to do matrix transformations that was written in
> ASSEMBLER to optimized the floating point processor pipelining (a start
> operation every cycle while it took 3 cycles to complete) and it performed
> about 15% better.
>
> I have not found anything similar in Pharo, but it must if external
> libraries are used. NativeBoost seems to come close, but I cannot find any
> documentation. Can someone point me to some documentation, code, anything?
> It is greatly appreciated.
>
> bw
>

Reply via email to