Click here to Skip to main content
15,907,326 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Generalimporting fortran dll's Pin
alankrita17-Aug-04 5:54
alankrita17-Aug-04 5:54 
GeneralRe: importing fortran dll's Pin
Dave Kreskowiak17-Aug-04 10:26
mveDave Kreskowiak17-Aug-04 10:26 
GeneralRe: importing fortran dll's Pin
progload17-Aug-04 15:19
progload17-Aug-04 15:19 
GeneralRe: importing fortran dll's Pin
progload17-Aug-04 15:24
progload17-Aug-04 15:24 
GeneralwaveOutGetDevCaps Pin
mivey417-Aug-04 5:14
mivey417-Aug-04 5:14 
GeneralRe: waveOutGetDevCaps Pin
Dave Kreskowiak17-Aug-04 5:37
mveDave Kreskowiak17-Aug-04 5:37 
GeneralRe: waveOutGetDevCaps Pin
mivey417-Aug-04 7:38
mivey417-Aug-04 7:38 
GeneralRe: waveOutGetDevCaps Pin
Dave Kreskowiak17-Aug-04 10:22
mveDave Kreskowiak17-Aug-04 10:22 
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto)>

This is why I asked for the code that declared the structure. This line makes sure that the structure members get packed together, in memory, in the order that they are declared and, if you follow the Win32 API documentation, the order that the API expects them in.

Without this line, the memory image of the structure can be anything in managed memory. This means that the structure can be moved at any time and can even be spread out and fragmented over a much larger block of memory.

Putting the LayoutKind.Sequential attribute in there makes sure that the structure is arranged in memory properly. ALL structure definitions being marshalled to the API require this attribute, otherwise you'll run into problems like the one you had with this one, and/or you can run into intermittant problems that you just can't figure out why it worked one time and not another...



RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

GeneralRe: waveOutGetDevCaps Pin
mivey418-Aug-04 5:52
mivey418-Aug-04 5:52 
GeneralRe: waveOutGetDevCaps Pin
Dave Kreskowiak18-Aug-04 6:27
mveDave Kreskowiak18-Aug-04 6:27 
GeneralRe: waveOutGetDevCaps Pin
Dave Kreskowiak18-Aug-04 12:21
mveDave Kreskowiak18-Aug-04 12:21 
GeneralRe: waveOutGetDevCaps Pin
Anonymous17-Aug-04 6:34
Anonymous17-Aug-04 6:34 
GeneralRe: waveOutGetDevCaps Pin
Anonymous17-Aug-04 6:53
Anonymous17-Aug-04 6:53 
GeneralRe: waveOutGetDevCaps Pin
mivey417-Aug-04 9:11
mivey417-Aug-04 9:11 
GeneralRe: waveOutGetDevCaps Pin
Anonymous17-Aug-04 9:34
Anonymous17-Aug-04 9:34 
GeneralRe: waveOutGetDevCaps Pin
Anonymous17-Aug-04 9:59
Anonymous17-Aug-04 9:59 
GeneralRe: waveOutGetDevCaps Pin
Anonymous17-Aug-04 10:24
Anonymous17-Aug-04 10:24 
GeneralRe: waveOutGetDevCaps Pin
mivey418-Aug-04 6:25
mivey418-Aug-04 6:25 
GeneralNeed to switch between Applications Pin
awhucks17-Aug-04 4:49
awhucks17-Aug-04 4:49 
GeneralRe: Need to switch between Applications Pin
Pablo.ar17-Aug-04 6:48
Pablo.ar17-Aug-04 6:48 
GeneralRe: Need to switch between Applications Pin
awhucks17-Aug-04 7:36
awhucks17-Aug-04 7:36 
GeneralRe: Need to switch between Applications Pin
awhucks17-Aug-04 7:51
awhucks17-Aug-04 7:51 
GeneralRe: Need to switch between Applications Pin
Pablo.ar17-Aug-04 16:16
Pablo.ar17-Aug-04 16:16 
Generaltransactions causing exceptions Pin
kowplunk17-Aug-04 4:45
kowplunk17-Aug-04 4:45 
GeneralRe: transactions causing exceptions Pin
Dave Kreskowiak17-Aug-04 5:29
mveDave Kreskowiak17-Aug-04 5:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.