PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

OpenDisplay() throws native exception - SOLVED

Hello,

I am currently evaluating GAPIDraw for our company.
I've started by writing a test application in C#, where I want to use the GAPIDraw library.

I found the intuitex GapiDRAW.Net library, which I'm using as a starting point for wrapping GD in C# method calls. It seems to be written for the 3.01 version of GAPIDraw, so I just updated the dll references - looking at the GAPIDrawNet.h in 3.6 is seems that the method signatures I need initially are unchanged from the older version.

Anyway, I've managed to instantiate/create surfaces and a display using P/Invoke-calls to the GAPIDraw dll.

However, when I subsequently try to call CGapiDisplay_OpenDisplay I get a native exception (code 0xc0000005). Same behavior in both emulator (Windows Mobile 5) and device (HTC S710 phone running Windows Mobile 6). I currently call all GAPIDraw code directly from a standard windows Form class.

What are probable causes for this exception?
Never mind, I sussed it out on my own.

GapiDraw.Net is written for GapiDraw 3.01, before the global gapidraw object was introduced to the api, so
GapiDraw.Net classes don't instantiate and pass the pointer to the global gapidraw object in constructors - result is access violations when the gapidraw function try to use the non-existing gapidraw object.

Added explicit instantiation and passing of gapidraw object to the gapidraw.net classes, opendisplay etc now works.

Sorry for spamming the forum. :)