Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

array of structure

1 view
Skip to first unread message

equi...@starband.net

unread,
Jan 8, 2008, 8:37:17 PM1/8/08
to
We have a VB dotNet app that has a Fortan DLL being called to execute
some calculations.
The Fortran Dll expects some arrays of what is a kind in Fortran which
isanalagous to a structure in DotNet.


We have had problems in the past with VB6 passing arrays of UDT to
Fortran. In VB6, the order that the UDT elements are added to the
stack cannot be guaranteed.
If we populate an array of structures and pass it to a com dll such as
the Fortran DLL, will we face the same issues with structure elements
being added to the stack?
In other words, does the CLR handle structure elements better than VB6
handled UDT elements in adding them to the stack?

TIA

Andrew D. Newbould

unread,
Jan 11, 2008, 7:57:52 PM1/11/08
to
In message
<24388fd6-f7e6-4d2c...@k2g2000hse.googlegroups.com>,
equi...@starband.net writes

The CLR will normally optimise a Structure at compile time and therefore
you would experience similar problems. However, that being said, you can
specify an Attribute to the Structure to turn this feature Off. See the
<StructLayout()> attribute in System.Runtime.InteropServices for
details.

--
Andrew D. Newbould E-Mail: NO-usen...@zadsoft.com

ZAD Software Systems Web : www.zadsoft.com

equi...@starband.net

unread,
Jan 16, 2008, 9:29:47 AM1/16/08
to
On Jan 11, 6:57 pm, "Andrew D. Newbould" <NO-usenet-S...@zadsoft.com>
wrote:
> In message
> <24388fd6-f7e6-4d2c-aff6-0f725609c...@k2g2000hse.googlegroups.com>,
> equis...@starband.net writes

>
>
>
>
>
> >We have a VB dotNet app that has a Fortan DLL being called to execute
> >some calculations.
> >The Fortran Dll expects some arrays of what is a kind in Fortran which
> >isanalagous to a structure in DotNet.
>
> >We have had problems in the past with VB6 passing arrays of UDT to
> >Fortran. In VB6, the order that the UDT elements are added to the
> >stack cannot be guaranteed.
> >If we populate an array of structures and pass it to a com dll such as
> >the Fortran DLL, will we face the same issues with structure elements
> >being added to the stack?
> >In other words, does the CLR handle structure elements better than VB6
> >handled UDT elements in adding them to the stack?
>
> >TIA
>
> The CLR will normally optimise a Structure at compile time and therefore
> you would experience similar problems. However, that being said, you can
> specify an Attribute to the Structure to turn this feature Off. See the
> <StructLayout()> attribute in System.Runtime.InteropServices for
> details.
>
> --
> Andrew D. Newbould                  E-Mail:  NO-usenet-S...@zadsoft.com
>
> ZAD Software Systems                Web   :  www.zadsoft.com- Hide quoted text -
>
> - Show quoted text -

Thank you very much for the response. I will check it out.
(;()}

equi...@starband.net

unread,
Jan 17, 2008, 10:23:56 AM1/17/08
to
> > ZAD Software Systems                Web   :  www.zadsoft.com-Hide quoted text -

>
> > - Show quoted text -
>
> Thank you very much for the response. I will check it out.
> (;()}- Hide quoted text -

>
> - Show quoted text -


OK, here is another issue. The explicit option LayoutKind.explicit
works for most of our structures, but we have a couple that include an
array of doubles as one of the members of the structures that can have
a variable number of elements that follow an array of doubles that has
a fixed number of elements.

Should I just use sequential for these structures without specifying
any offsets, or can I use sequential and still specify the offsets for
the first few members of the structure?

TIA

0 new messages