Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here's my guess, based on the C type signature and the <a href="http://www.astro.com/swisseph/swephprg.htm#_Toc335137304" rel="nofollow">function documentation</a> I found. It compiles, but you'll have to tell me if it actually works since I don't have the <code>swedll32.dll</code> assembly. Also, my code doesn't require the F# Powerpack assembly.</p> <p>EDIT: Just read the comments under @kvb's answer -- he suggested the same thing I included in my code, which is the <code>[&lt;MarshalAs(...)&gt;]</code> attribute with the <code>SizeConst</code> property set. I also added <code>[&lt;Out&gt;]</code>, because the last two parameters are used as return values; IIRC, it also affects marshalling behavior.</p> <p>EDIT 2: Removed the <code>ExactSpelling = true</code> from the <code>MarshalAs</code> attribute, as per @wolfgang's report.</p> <pre><code>[&lt;DllImport(@"swedll32.dll", CharSet = CharSet.Ansi, EntryPoint = "swe_calc_ut")&gt;] extern int32 swe_calc_ut ( float tjd_ut, int32 ipl, int32 flag, [&lt;Out; MarshalAs(UnmanagedType.LPArray, SizeConst = 6)&gt;] float[] xx, [&lt;Out; MarshalAs(UnmanagedType.LPStr, SizeConst = 256)&gt;] System.Text.StringBuilder serr) // Wrapper function for swe_calc_ut let swe_calc_ut_wrapper (tjd_ut, ipl, flag) = let positions = Array.zeroCreate 6 let errorSB = System.Text.StringBuilder (256) let result = swe_calc_ut (tjd_ut, ipl, flag, positions, errorSB) if result &lt; 0 then // Error Choice2Of2 (result, errorSB.ToString ()) else Choice1Of2 positions </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload