Page 1 of 1

how to link libraries

Posted: 13 Mar 2005 02:27
by gaituc
Hi, I've created a new module in VLC, I've compiled and all works. But now I have to add some new functionalities, and to do so I need to use some libraries which are not contained in VLC. What can I do to link external libraries?

Posted: 13 Mar 2005 15:58
by The DJ
study configure.ac

look for instance for something like the ogg header check.
dnl
dnl ogg demux plugin
dnl
AC_ARG_ENABLE(ogg,
[ --enable-ogg Ogg demux support (default enabled)])
if test "${enable_ogg}" != "no"
then
AC_CHECK_HEADERS(ogg/ogg.h, [
AC_CHECK_LIB( ogg, oggpack_read, [
VLC_ADD_PLUGINS([ogg])
if test "${enable_sout}" != "no"; then
VLC_ADD_PLUGINS([mux_ogg])
fi
VLC_ADD_LDFLAGS([ogg mux_ogg],[-logg])])
],[])
fi


this says.
if --enable-ogg is specified
then
check for the ogg/ogg.h header presence in the standard include directories
check for the oggpack_read function in the ogg library in the standard lib directories (unrequired for you case prop. but this can be done to ensure this spefic required function is present)
If all this is OK, then add the VLC ogg module to the list of VLC modules to be compiled
[skip sout stuff]
Add the linker flag -logg if we compile the ogg and/or the mux_ogg vlc modules


after changing configure.ac you need to run the bootstrap script and reconfigure/compile VLC.

See also the file HACKING in the vlc sources.