Original Post
Hello all, perhaps someone here has some experience with pinvoke and can give me a helpfull hint. Here is my problem: I am using Pinvoke from c# (dotnet 2.0 beta) to access an unmanageddll (ODE.dll) and everyting works just dandy except for two important calls that use a callback (dSpaceCollide & dSpaceCollide2). These two calls may call the passed in callback a number of times. Everyting seems to go swimmingly I get the first callback and the paremeters are correct, but I only get one and then I get an AccessViolationException (Accessing protected memeory). I am at my wits end. I have tried fixing all of the params to the function, Tweaking all of the values even using GCHandle to try and protect the callback and I still get an Access violation. I have even gone so far as to study the source of the unmanaged library, suspecting that it might be something internal to the dll -- though I now believe that that is unlikely. If anyone has any idea what is going on here I could really use the help. Thanks.