Skip to main content
GameDev.net gamedev.net
🔒 Locked

Memory Alignment for ActiveX

Started by jwalker May 22, 2002 at 10:01 PM 0 replies 150+ views
Original Post
jwalker
jwalker
i recently encountered a wierd memory problem with activex.. i build a control that supports both automation and mime loading from explorer.. the problem was that when loaded from vbScript, it was fine. In explorer it crashed. I solved the problem by changing just 1 line of code.
  
  // sample code, names change to reduce size of post

  __int8 x = (__int8)(255 * col);

  // changed to

  unsigned short x = (USHORT)(255 * col);
  
the first line of code actually overflowed into OTHER variables and corrupted an array. When i delete the array, delete would crash because memory cannot be read. does anyone have any tutorials on win32 memory alignement ?? btw, i am using vc6 Its my duty, to please that booty ! - John Shaft

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.