LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

general protection fault when calling OEM API

Hi there,

 

I am trying to use an API to communicate with a USB camera  (Firefly, Point Grey Research).  The documentation  says that it is C/C++ compatible.  The API works OK when used from within Visual Studio, but I'd like to use it from within LabWindows/CVI (8.0).  The program compiles and links OK but I get the following run-time error when invoking any function:

 

FATAL RUN-TIME ERROR:   Unknown source position, thread id 0x00003408:   A non-debuggable thread caused a 'General Protection' fault at address 7C915236.

 

I contacted the company but since they have no experience with LabWindows, they could not help me.  Here's what the code looks like: 

 

__declspec(dllexport)   int  __cdecl flycaptureBusCameraCount(unsigned int*);

void cameraInitialization(){
     unsigned int numcams;

     flycaptureBusCameraCount(&numcams);
     printf("numcams %d\n",numcams); 

}

 

 Is what I am trying to do feasible?  Is there an easy fix for that?

 

Thanks,

Richard 

0 Kudos
Message 1 of 7
(4,093 Views)

RTA,

 

CVI, is an ANSI C compiller, so if the API is using C syntax, then it should be able to be utilized by LabWindows. If the API requires the Object Oriented programming features of C++, then you will not be able to use CVI. The error you posted is a generic windows run-time error, and doesn't really tell us anything. What line do you get this error on? Is the error comming from their program or from your's ?

 

How do you get access to the functions such as flycaptureBusCameraCount() in this API ? Can you point me at some of their documentation and I may be able to give you a better idea of whether or not this is possible. If not, we do offer a plugin to Visual Studio, called Measurement Studio that you would definetly be able to use with this USB camera. 

Richard S -- National Instruments -- (former) Applications Engineer -- Data Acquisition with TestStand
0 Kudos
Message 2 of 7
(4,072 Views)

Hi Richard,

 

Thanks for your reply.  You can find the doc on their API at http://www.ptgrey.com/products/pgrflycapture/index.asp (general) and at http://www.ptgrey.com/support/downloads/documents/flycapture/flycapture_start.htm (technical). Although the doc mentions only IEEE-1394,it also applies to USB.  According to them, it should work from plain C.  

 

I get the error from within their function (in this case flycaptureBusCameraCount ).  In fact, if I disconnect the camera the programs runs without crashing; so linkage seems all right, the crash happens when the function actually tries to do something.  The functions reside in a library which is in my project's directory.

 

As I am not a Visual Studio programmer so Measurement Studio would not help me.  I was just hoping to get this camera (or any USB camera) to work with LabWindows.

 

Thanks,

Richard 

0 Kudos
Message 3 of 7
(4,066 Views)

Although they say that it will work for C, it also says that it is object oriented:



http://www.ptgrey.com/support/downloads/documents/flycapture/flycapture_start.htm



The much anticipated FlyCapture 2.0 provides users
with the ability to develop applications under both Microsoft Windows and Linux
operating systems, and is fully compatible with all Point Grey 1394 and USB
cameras. FlyCapture 2.0 also features a simpler and more intuitive object
oriented
API, including C and C++.


Also all of the examples seem to be ritten explicitly for Visual Studio. If you could ask their support "Can I use this API with ANSI C ?" they should be able to give you a direct answer. If they have any questions about LabWINDOWS you can direct them to this forum post, or paraphrase their question, and i'll be happy to answer.  I'm unable to download an evaluation of this software right now, and the documentation doesn't say what exactly the API is. Is it a DLL that you require in your project, an active-x server that we talk to? What kind of references do
we need in our project to get access to this API ? (also this is probably not the problem, but it looks like in the reference code you posted earlier, you're defining a function that also calls a function of that same name, you may want to change the name, so we don't run into any errors.

Richard S -- National Instruments -- (former) Applications Engineer -- Data Acquisition with TestStand
0 Kudos
Message 4 of 7
(4,063 Views)

Hi Richard,

 

Point Grey provided me with their latest API (version 2.0) that has C examples.  Now I can not even get my project to link OK; I get the following errors:

 

 15 Project link errors

  Undefined symbol '_fc2DestroyContext' referenced in "fc.c".

  Undefined symbol '_fc2GetNumOfCameras' referenced in "fc.c".

(... and so on) 

 

Am I doing things right?  I have put their *.lib files in my project directory and also added them to my project file tree.  Any suggestions?

 

Thanks,

Richard 

0 Kudos
Message 5 of 7
(3,999 Views)

Sounds like you haven't added the proper #include's to the top of your file. Without more information like where these symbols are defined it's going to be hard to determine exactly what you need to include to fix this linker error.

 

Regards,

 

Steven Zittrower

Applications Engineer

National Instruments

http://www.ni.com/support

0 Kudos
Message 6 of 7
(3,981 Views)

No, I had the right includes.  After weeks of research from the support team at Point Grey Research, they found out that the problem was only happening with LabWindows 8.0, the software is OK with LabWindows 9.0.  So, I guess we'll never really know what the problem was, but the bottom line is that it works with 9.0.  Unfortunately, to fix our problem, we have to pay for the upgrade from 8.0 to 9.0 which is not cheap.

 

 

Richard 

0 Kudos
Message 7 of 7
(3,883 Views)