sdklibreoffice-calcuno

An error occurs while compiling an idl file to an rdb file


Good afternoon. I have an idl file, here is its contents:

#include <com/sun/star/uno/XInterface.idl>

module org { module libreoffice { module sheet { module formulas {

interface XDataLinkFormulas : com::sun::star::uno::XInterface {
    long Vol(
        [in] long a,
        [in] long b,
        [in] long c
    );
};

}; }; }; };

On Linux, I compile these files into an rdb file using the following command:

sudo ./unoidl-write formulas.idl formulas.rdb

However, this command fails with the following error:

Bad input file:///opt/libreoffice7.5/sdk/bin/formulas.idl: cannot parse line 4: "interface type org.libreoffice.sheet.formulas.XDataLinkFormulas direct base com.sun.star.uno.XInterface does not resolve to an existing interface type"

enter image description here

Question: how do I fix this error, because I did the contents of the idl file by analogy with the existing examples.

P.S. I placed my idl (formulas.idl) file in the following directory (/opt/libreoffice7.5/sdk/bin)


Solution

  • To avoid the interface type error, add a reference to types.rdb. Here is a working powershell script for Windows.

    $idlFile = "../idl/XCalcFunctions"
    $loHome = "C:/Program Files/LibreOffice/program"
    $sdkHome = "C:/libreoffice7.5.3.2/sdk"
    $tools = "$sdkHome/bin"
    $unoTypes = "$loHome/types.rdb"
    $offTypes = "$loHome/types/offapi.rdb"
    $env:PATH += ';' + $loHome  # for DLLs
    
    & "$tools/unoidl-write.exe" $unoTypes $offTypes "$idlFile.idl" "$idlFile.rdb"
    

    This is based on the example at https://www.spinics.net/lists/libreoffice/msg09080.html.

    export PATH=/usr/lib64/libreoffice/sdk/bin:/usr/lib64/libreoffice/program:/usr/bin
    export LD_LIBRARY_PATH=/usr/lib64/libreoffice/program:/usr/bin
    export unoTypes=/usr/lib64/libreoffice/program/types.rdb
    export offTypes=/usr/lib64/libreoffice/program/types/offapi.rdb
    unoidl-write $unoTypes $offTypes com/sun/star/test/XSomethingA.idl XSomething.rdb