[Libreoffice-qa] How to link a .so library

Jingze Xu qdxujingze18 at 126.com
Mon Jun 19 09:40:46 UTC 2023


Dear all, 
Hi, I'm new to libreoffice and its forum. I have a question but I am not sure where to ask. If this is the right place, here is the question :)


---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Question:
I have successfully added a new dialog in Impress according to the steps in this tutorial - Development/Create new dialog in Impress - The Document Foundation Wiki. Now I wish to call functions in an external library in the dialog source file.
I have an external library libxxx containing some C++ header files and a .so file. I put the header files in include/ folder and .so file outside libreoffice directory. I include the header files of this library in dialog source files located in sd/source/ui/dlg. I rerun the autogen.sh with extra arguments, trying to let the build system know I have a .so library to link. 


./autogen.sh LDFLAGS=-L/path_to_libxxx LIBS=-lxxx


Then I rebuild the sd module using make sd, however, it seems the functions in .so library is not properly linked. 


"/usr/bin/ld: /home/jingze_xu/office/libreoffice-7.6.0.0.beta1/workdir/CxxObject/sd/source/ui/dlg/HelloDialog.o: in function `sd::SdHelloDialog::OKHdl(weld::Button&)':
HelloDialog.cxx:(.text+0x36c): undefined reference to `Add_FileHeader(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned short)'
collect2: error: ld returned 1 exit status
make[1]: *** [/home/jingze_xu/office/libreoffice-7.6.0.0.beta1/sd/Library_sdui.mk:10: /home/jingze_xu/office/libreoffice-7.6.0.0.beta1/instdir/program/libsduilo.so] Error 1
make: *** [Makefile:121: sd] Error 2"


Are there some clues about linking so library in libreoffice codebase?
Thanks!
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


If this is not the right place to ask questions, I'm sorry about this and please tell me where to ask questions. Thanks!


Best wishes,
Jingze Xu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-qa/attachments/20230619/c769d51c/attachment.htm>


More information about the Libreoffice-qa mailing list