Reputation: 121
I'm starting an OpenGL Application via glc-capture. glc is a c-library which hooks on the OpenGL buffer and x11 server. glc needs a key command in the OpenGL display to start recording the OpenGL output.
But my software should start recording the output programmatically, not via a key presses. The glc files are all too complex for my basic knowledge to understand them completely. But basically the structur seems to be the following:
The glc-capture is a shell script which does some settings and executes LD_PRELOAD=libglc-capture.so "${@}"
. x11.c contains the x11 hook which listens for key events. There are some initializations going on.
On a special key event the function start_capture()
is executed by x11.c.
start_capture()
is defined in a file lib.h and implemented in the main.c file.
My questions:
How can I execute the start_capture() function on my own c++ application?
I tried link the libraries (hook and capture) via CMakeList.txt
and include the header file, but that always leaves me at "undefined reference: start_capture()".
Here is the line from CMakeList.txt which links the libraries:
target_link_libraries(${PROJECT_NAME} ${QT_LIBRARIES} libglc-hook.so libglc-capture.so libglc-core.so libglc-export.so)
EDIT2: Here is the error I get at runtime:
/opt/ros/fuerte/stacks/visualization/rviz/bin/rviz: symbol lookup error: /home/jrick/fuerte_workspace/sandbox/Bag2Film/lib/libBag2Film.so: undefined symbol: start_capture
The output from nm:
jrick@robot2:~/fuerte_workspace/sandbox/Bag2Film/lib$ nm libBag2Film.so | grep capture
0000000000003a30 t start_capture
0000000000003790 t stop_capture
Upvotes: 0
Views: 2752
Reputation: 14169
I don't know about glc-capture, but from what you say it should be possible to linke your application directly against libglc-capture (try passing -lglc-capture
as a linker flag). Consult the libraries documentation if that doesn't work.
In addition, you would have to include a header file that includes the declaration of start_capture
. Again, consult the library documentation to find out about which file to use. If there's no header present, you can still declare it yourself (sounds like a C-library, so something along the line extern "C" { void start_capture(); }
might do it.
If your project still compiles and links after these changes, add a call to start_capture()
where you need it.
Come back here if it doesn't help.
Upvotes: 2