what could cause this "native exception" error

R

rocio

I am developing in .NET CF, of course, for the PocketPC
But I'm importing a DLL created in embedded C++ using PInvoke. This DLL is for the VEO Photo Traveler camera:

Declare Function CamOpen Lib "veocamapi.dll" (ByRef hCam as IntPtr) as CAM_ERRORS

Dim hCam as IntPtr
Dim err as CAM_ERRORS
Try
err = CamOpen(hCam)
catch ......
:
The program crashes at the statement err = CamOpen(hCam), does not even get to the catch statement where I could my customized error messages.
The error it throws says:

A native exception occurred.

ExceptionCode: 0xc0000005
ExceptionAddress: 0x016d6d48
Writing: 0x20000000

Note however, that this error happens when the VEO camera is connected to the PPC. If it is not connected, the function CanOpen returns a err value of "camera is not connected", which is fine of course.
When I connect the camera to the PPC I make sure it is working correctly, then I close the application completely before trying my code.

The VEO Photo Traveler SDK also comes with a source code in embedded C++, and a compiled program that uses this DLL.
(I do not know C++, much less do not have the SDK to run this source code, but I looked at some of the .cpp files to get an idea on how the DLL functions are called).
I copied this program, a .exe file into my PPC and run it with no problems. If I delete the DLL from the PPC, then this program cannot run and tells me nicely that files are missing for it to execute (veocamapi.dll). So if I thought that it is the DLL with the problem, it is not, since this .exe program can access it with no problems. Furthermore, I can access the DLL when the camera is not connected to the PPC, it just crashes when the camera is connected. But I tested the camera when it is connecetd and it functions normally.

Your thoughts/ideas on what could be wrong, or what in general throws a native exception will be very appreciated.
 
J

Joe Audette

a native exception just means the error occurred in
unmanged code such as your dll rather than in code managed
by the common language runtime.
-----Original Message-----
I am developing in .NET CF, of course, for the PocketPC
But I'm importing a DLL created in embedded C++ using
PInvoke. This DLL is for the VEO Photo Traveler camera:
Declare Function CamOpen Lib "veocamapi.dll" (ByRef hCam as IntPtr) as CAM_ERRORS

Dim hCam as IntPtr
Dim err as CAM_ERRORS
Try
err = CamOpen(hCam)
catch ......
:
The program crashes at the statement err = CamOpen
(hCam), does not even get to the catch statement where I
could my customized error messages.
The error it throws says:

A native exception occurred.

ExceptionCode: 0xc0000005
ExceptionAddress: 0x016d6d48
Writing: 0x20000000

Note however, that this error happens when the VEO camera
is connected to the PPC. If it is not connected, the
function CanOpen returns a err value of "camera is not
connected", which is fine of course.
When I connect the camera to the PPC I make sure it is
working correctly, then I close the application completely
before trying my code.
The VEO Photo Traveler SDK also comes with a source code
in embedded C++, and a compiled program that uses this DLL.
(I do not know C++, much less do not have the SDK to run
this source code, but I looked at some of the .cpp files
to get an idea on how the DLL functions are called).
I copied this program, a .exe file into my PPC and run it
with no problems. If I delete the DLL from the PPC, then
this program cannot run and tells me nicely that files are
missing for it to execute (veocamapi.dll). So if I
thought that it is the DLL with the problem, it is not,
since this .exe program can access it with no problems.
Furthermore, I can access the DLL when the camera is not
connected to the PPC, it just crashes when the camera is
connected. But I tested the camera when it is connecetd
and it functions normally.
Your thoughts/ideas on what could be wrong, or what in
general throws a native exception will be very appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top