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

N J raphexion at gmail.com
Wed Jun 30 16:37:46 UTC 2010


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?




More information about the cffi-devel mailing list