[cffi-devel] help with load-foreign-library

N J raphexion at gmail.com
Wed Jun 30 17:36:26 UTC 2010


Thanks for the quick help.

I think I got some insight into the problem. Frank is right, there is
no cvCaputerFromCam anymore in the API. And as Stelian noted, one
probably need to acount for the differences between C and C++.

However,, I finally extracted a nice list of the functions available with
objdump /usr/lib64/libhighgui.so -t | gawk '{ print $6 }' | grep -v _Z
| sort | grep cv | grep -v cpp

cvConvertImage
cvCreateCameraCapture
cvCreateFileCapture
cvCreateTrackbar
cvCreateTrackbar2
cvCreateVideoWriter
cvDecodeImage
cvDecodeImageM
cvDestroyAllWindows
cvDestroyWindow
cvEncodeImage
cvGetCaptureDomain
cvGetCaptureProperty
cvGetTrackbarPos
cvGetWindowHandle
cvGetWindowName
cvGrabFrame
cvHaveImageReader
cvHaveImageWriter
cvInitSystem
cvLoadImage
cvLoadImageM
cvMoveWindow
cvNamedWindow
cvQueryFrame
cvReleaseCapture
cvReleaseVideoWriter
cvResizeWindow
cvRetrieveFrame
cvSaveImage
cvSetCaptureProperty
cvSetMouseCallback
cvSetTrackbarPos
cvShowImage
cvStartWindowThread
cvTopLevelWidget
cvWaitKey
cvWriteFrame

However, thanks for the quick help.

Best regards,
Nik

On Wed, Jun 30, 2010 at 7:11 PM, Frank Goenninger <frgo at me.com> wrote:
> Hi -
>
> not really knowing libcv but just staring at the nm output:
>
> There are CvCaptureCAM functions bjt no cvCaptureFromCAM in the library ...
>
> Cheers
>  Frank
>
> Am 30.06.2010 um 18:37 schrieb N J:
>
>> Hi,
>>
>> I have a question about how to find a function in the opencv library.
>>
>> I tried this:
>>
>> (require :cffi)
>>
>> ;; load shared libs
>> (cffi:load-foreign-library "libcv.so")
>> (cffi:load-foreign-library "libhighgui.so")
>>
>> ;; define the function call CvCapture* capture = cvCaptureFromCAM( -1 );
>> (cffi:defctype cvcapture :pointer)
>> (cffi:defcfun "cvCaptureFromCAM"
>>    cvcapture
>>  (type :int))
>>
>> But I get:
>> STYLE-WARNING: Undefined alien: "cvCaptureFromCAM"
>>
>> Which means that "cffi" cannot find the name in the shared object file.
>>
>> My shared object file looks like this:
>>
>> nm /usr/lib64/libhighgui.so | grep -i cvcapturefromcam
>> 000000000023d180 b _ZZL21icvCaptureFromCAM_V4LiE9autoindex
>>
>> nm /usr/lib64/libhighgui.so | grep -i cvcapturecam
>> 0000000000021760 t _ZL15icvCloseCAM_V4LP16CvCaptureCAM_V4L
>> 0000000000021fa0 t _ZL15icvSetVideoSizeP16CvCaptureCAM_V4Lii
>> 00000000000225f0 t _ZL19icvGrabFrameCAM_V4LP16CvCaptureCAM_V4L
>> 00000000000216a0 t _ZL33v4l2_scan_controls_enumerate_menuP16CvCaptureCAM_V4L
>> 0000000000021940 T _ZN20CvCaptureCAM_V4L_CPP11getPropertyEi
>> 00000000000221c0 T _ZN20CvCaptureCAM_V4L_CPP11setPropertyEid
>> 0000000000021d60 T _ZN20CvCaptureCAM_V4L_CPP13retrieveFrameEi
>> 0000000000022a10 T _ZN20CvCaptureCAM_V4L_CPP4openEi
>> 0000000000021880 T _ZN20CvCaptureCAM_V4L_CPP5closeEv
>> 00000000000229f0 T _ZN20CvCaptureCAM_V4L_CPP9grabFrameEv
>> 00000000000218b0 W _ZN20CvCaptureCAM_V4L_CPPD0Ev
>> 0000000000021900 W _ZN20CvCaptureCAM_V4L_CPPD1Ev
>> 000000000023af40 V _ZTI20CvCaptureCAM_V4L_CPP
>> 0000000000033c20 V _ZTS20CvCaptureCAM_V4L_CPP
>> 000000000023aee0 V _ZTV20CvCaptureCAM_V4L_CPP
>> 000000000023d174 b _ZZL21icvSetPropertyCAM_V4LP16CvCaptureCAM_V4LidE5width
>> 000000000023d170 b _ZZL21icvSetPropertyCAM_V4LP16CvCaptureCAM_V4LidE6height
>>
>> Questions:
>> 1) Am I doing it all wrong or can one do like this?
>> 2) Is there a smart way to use the .so file to get the correct name of
>> functions?
>>
>> _______________________________________________
>> cffi-devel mailing list
>> cffi-devel at common-lisp.net
>> http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel
>
>




More information about the cffi-devel mailing list