views:

38

answers:

1

So I've now progressed to having an almost functioning wrapper.
Other posts regarding my wrapper issues are:
http://stackoverflow.com/questions/2430089/c-wrapper-and-callbacks &
http://stackoverflow.com/questions/2444687/c-wrapper-for-array-of-three-pointers

I use the wrapper to establish a connection to the Dallmeier using the following:

_dallmeier.SessionHandle = DallmeierSDK.dlm_connect(_handle, _ip, "", _pass, null, null, connectionCallback, pInPut)  

This returns the session handler. After awhile I get a AccessVoilationException about attempted to read or write protected memory.

I think this has something to do with using Marshal.Read and/or Marshal.Copy (as stated in one of the posts above) but I'm not sure where I use these commands.

Can some please advise me on this and/or examples?

+1  A: 

maybe you could try wrapping your code in a fixed block, to prevent moving the pointer in memory or being GC-collected.

ralf.w.