<p dir="ltr">Cool. I&#39;m going to try this out. </p>
<p dir="ltr">Chris<br>
</p>
<div class="gmail_quote">On Sep 12, 2015 7:47 PM, &quot;David T. Lewis&quot; &lt;<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>&gt; wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Thu, Sep 10, 2015 at 10:29:24AM -0700, tim Rowledge wrote:<br>
&gt;<br>
&gt; On 09-09-2015, at 6:53 PM, David T. Lewis &lt;<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>&gt; wrote:<br>
&gt;<br>
&gt; &gt; On Wed, Sep 09, 2015 at 11:17:08AM -0700, tim Rowledge wrote:<br>
&gt; &gt;&gt; I?m trying - and so far failing - to do what should surely be a very simple<br>
&gt; &gt;&gt; thing. This isn?t a new situation?  especially on unix.<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; I have a single C file with just two functions. I have a matching H file.<br>
&gt; &gt;&gt; I want to make them into a dynamic library that I can call via FFI. This<br>
&gt; &gt;&gt; really shouldn?t be rocket science stuff!<br>
&gt; &gt;<br>
&gt; &gt; &lt;OT&gt;<br>
&gt; &gt; I assume there is some good reason that you would not do an end run<br>
&gt; &gt; around all that rocket science and just write a plugin?<br>
&gt;<br>
&gt; Well I *did* originally point out that there was probably a really stupid mistake in my process and that is pretty much it. In my defence I was in the midst of FFI-ing to multiple external libraries for assorted Pi add-on doohickeys and getting somewhat inured to the idea.<br>
&gt;<br>
&gt; But I think I may re-do it as a plugin today, not least because it seems that the ARM ffi interface has a problem with returning floats; they come back as Character null. I may not be a great IEEE floating point standard expert but that doesn?t seem quite right.<br>
&gt;<br>
<br>
I don&#39;t know what got into me, but I brewed up a nice pot of coffee this<br>
morning and ended up with <a href="http://squeaksource.com/MadgwickAHRS/" rel="noreferrer" target="_blank">http://squeaksource.com/MadgwickAHRS/</a><br>
<br>
This is a plugin, accessor class, and unit tests that claim to demonstrate<br>
that the plugin works.<br>
<br>
I used FloatArray for parameter passing, on the theory that users of the<br>
plugin may be doing float (not double) arithmetic, so it may be more<br>
efficient to pass values in that manner.<br>
<br>
It works with 32/64 bit image and host, and the plugin builds without complaint<br>
(trunk with Ian&#39;s Cmake build) if you put the library source files<br>
MadgwickAHRS.c and MadgwickAHRS.h in platforms/Cross/plugins/MadgwickAHRS/<br>
<br>
The MadgwickAHRS library is licensed GPL, so it would be best to link<br>
the plugin dynamically to e.g. /usr/local/iib/libwmadgwickIMU.so.1<br>
rather than static link to the C code as I have done so far. If there<br>
is any interest in the plugin, I&#39;ll see if I can figure out the linker<br>
magic.<br>
<br>
See class MadgwickAHRSTest for examples.<br>
<br>
Repository is at <a href="http://www.squeaksource.com/MadgwickAHRS" rel="noreferrer" target="_blank">http://www.squeaksource.com/MadgwickAHRS</a><br>
<br>
Tim, I added you as developer on the <a href="http://squeaksource.com" rel="noreferrer" target="_blank">squeaksource.com</a> repository in case you<br>
want to make use of this.<br>
<br>
Dave<br>
<br>
<br>
</blockquote></div>