Re: Problem closing app with big UDT



In article <u5YSTFcDHHA.3604@xxxxxxxxxxxxxxxxxxxx>, Dan@xxxxxxxx says...
This same structure works with no trouble in
Delphi.

Are you trying to pass the UDT between VB and Delphi, or do you just mean
that the Delphi equivalent works fine?

Passing it back and forth between a Delphi .dll to a VB application.
Yes, we are aware of the alignment issue, and have designed with that in
mind. ALL the data is of one of 3 types: Long, Double, or Byte array.
All the array sizes are multiples of 4, so the 4-byte alignment should
be maintained throughout unless we screwed up somewhere. We didn't
think of passing the whole thing as a byte array, and it's too late to
go back and rework it now.

My gut feeling is that there's something in the .dll that isn't
intializing a small part of the structure correctly; I've got the Delphi
programmer looking at this, because it used to work ok. But I don't
know what (if anything) has changed, so it's tough to isolate.


As JFrench said, if you're passing the data between VB and Delphi you need
to be sure the alignment matches. Note that there are *more options* than
just Packed or not Packed ("Project Options|Compiler|Record field
alignment"). Delphi allows you to specify the alignment boundary. You
should also carefully check the data types.

FWIW, I don't pass UDT's as UDT's. I put them in byte arrays for the pass
so I can't speak from experience on making it work. I think it should be OK
though..

Dan


"David Kerber" <ns_dkerber@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:MPG.1fcb718e18e4ad9b989a4a@xxxxxxxxxxxxxxxxxxxxxx
I have an app which uses a big (44708 bytes) UDT, which is made up of
Longs, Doubles and byte arrays. Since that is bigger than 32k, the
compiler chokes on it when I try to define it as a local, and demands
that I dim it as either a global or at the form level before it will
compile.

Once I do that, it runs fine until I shut down the app. When running in
the IDE, it just silently kills the IDE. When running compiled, it
throws the folloging "Application Error": The instruction at
"0x00000000" referenced memory at "0x00000000". The memory could not be
"read".

This isn't a show-stopper because the app works fine until I close it
out, but it's rather disconcerting, especially to my users. Any ideas
on how to fix this? This same structure works with no trouble in
Delphi.


--
Remove the ns_ from if replying by e-mail (but keep posts in the
newsgroups if possible).
.



Relevant Pages

  • Re: Problem closing app with big UDT
    ... Are you trying to pass the UDT between VB and Delphi, or do you just mean that the Delphi equivalent works fine? ... All the array sizes are multiples of 4, so the 4-byte alignment should be maintained throughout unless we screwed up somewhere. ... In any one app, maybe, but this dll is in production use in several different apps, in 3 different languages. ... So coming at it from a different direction is there any way I can, just in my VB app, send and receive the structure I need without actually passing it as a structure? ...
    (microsoft.public.vb.general.discussion)
  • Re: Problem closing app with big UDT
    ... Are you trying to pass the UDT between VB and Delphi, ... Passing it back and forth between a Delphi .dll to a VB application. ... ALL the data is of one of 3 types: Long, Double, or Byte array. ... In any one app, maybe, but this dll is in production use in several ...
    (microsoft.public.vb.general.discussion)
  • Re: Problem closing app with big UDT
    ... Do you have the two declarations (VB and Delphi) to post? ... the array specs. ... Match calls of complex types on both sides ... All the array sizes are multiples of 4, so the 4-byte alignment should ...
    (microsoft.public.vb.general.discussion)
  • Re: array of labels or array of buttons
    ... >>finally got a project that I can do in Delphi. ... >>time you cut and past one it asks if you want to make this an array. ... > draw the buttons in an OnDrawCell event handler of the stringgrid like ... ... > In this case I would use the Objects array of the string grid to store a value ...
    (alt.comp.lang.borland-delphi)
  • Re: Problem closing app with big UDT
    ... Are you trying to pass the UDT between VB and Delphi, or do you just mean that the Delphi equivalent works fine? ... All the array sizes are multiples of 4, so the 4-byte alignment should be maintained throughout unless we screwed up somewhere. ... We didn't think of passing the whole thing as a byte array, and it's too late to go back and rework it now. ... In any one app, maybe, but this dll is in production use in several different apps, in 3 different languages. ...
    (microsoft.public.vb.general.discussion)