Feature regarding structures in Mercury

I’ve just got around to testing the new build. It seems that the multidimensional array in both the struct and a locally declared variable are still being allocated as pointers. A new error has now occurred, in which the library function cannot be found under the release build (Inline method not found). This does not happen under debug build. The attributes are correct to mark it as an exported function, along with the DLL Import function. I’ve uploaded the test case. The compiled shared library will need to be manually added to the correct binary directory before running.

2darray_libtest.zip (30.8 KB)

I’m told this is as designed for Mercury. Because VB.NET allows all arrays to be redim’ed, they will all always be treated as s=dynamic arrays, even when declared with a fixed/initial size.

reproduced. this is a regression from before, and was fine esrlier?

It seems to be as I’ve compiled in release mode fine previously.

Is it possible to provide an attribute, mainly for the Island back end that explicitly allows this? VB.net had a fixed string/array attribute to assist with this quirk for marshalling with C API’s.

I can log a feature request. What attribute did VB.NET use?

Here were the original attributes, however I feel they’re a bit limited given it was more for the original nature of QB/VB prior the .NET era:

Ideally, I’d believe an attribute that forces (in this case, arrays of n-dimension) to be stack defined or block allocated (within structures) is the best approach.

Example:
<Fixed, Packed>
Structure test
t(2) As Double
m(2,2) As Double
End Structure

Size of test should be 72 instead of 16. Fixed enforces this.

Another example:

<Stack (or Fixed again)>
Dim m2(2,2) As Double

m2’s size should be 48

Logged as bugs://E26786.

I’ve logged E26787 for the release compiling issue.

That’s great. Is E26786 regarding the feature request? If so, will you implement the Fixed/Stack suggestion?

We’ll investigate it, yes

Has their been any consideration for this?

This issue is still open, but I’ll chase up the progress and make sure it gets priority. thanx!