call Pascal DLL functions from D

Oleg B code.viator at gmail.com
Wed Oct 25 10:47:56 UTC 2017


On Wednesday, 25 October 2017 at 04:30:12 UTC, Basile B. wrote:
> On Wednesday, 25 October 2017 at 03:12:56 UTC, Oleg B wrote:
>> 2. `array[A..B] of TFoo` is `TFoo[B-A+1]` (static array)
>
> No A-B. In Pascal the upper bound of a range (like here but i'm 
> not sure this i called like that in the grammar) or of a slice 
> is inclusive.
>
>> alias HarmonicArray = OneHarmonic[49];
>
> 48 !
>
> Most likely the problem is the array length.

If I wrote `array[5..7] of ...` I get array that can be indexed 
by `5`, `6` and `7`, right? It means that array have 3 elements. 
If A=5, B=7 then length of array is B-A+1, 7-5+1=3. In my case I 
have [1..49] and [2..50] ranges: 49-1+1=49, 50-2+1=49. I don't 
understand why length must be 48...
In any case I tried 48 and CheckSignalData function returns other 
error code, but it point to current field too (incorrect value of 
coefs - it can be if floating point value is badly read).


More information about the Digitalmars-d-learn mailing list