Ask Your Question
0

LibreOffice Linux, xls vba code to call a so library

asked 2020-01-17 17:36:44 +0100

gecos gravatar image

updated 2020-01-17 17:48:15 +0100

I am testing the Linux version of LibreOffice

Version: 6.0.7.3
Build ID: 1:6.0.7-0ubuntu0.18.04.10
CPU threads: 8; OS: Linux 5.0; UI render: default; VCL: x11; 
Locale: en-US (en_US.UTF-8); Calc: group

for tests I created a simple xls page with one macro (Sub mysub) to call a shared library test.so (64 bit, compiled with CLang and tested with Python), I have tested several modifications (meaning changing the "Private Declare Function mytest...") of the code working with the Windows version

Private Declare Function mytest Lib "test.so" (ByVal p As Long) As Long

Sub mysub
Dim i As Long
i = mytest(5)
end Sub

however (in all my tests) when debugging (step by step) some variant of the code

Private Declare Function mytest Lib "test.so" (ByVal p As Long) As Long

Libreoffice reports

BASIC runtime error. '73' Not implemented.

my questions :

1) does the LibreOffice Linux Basic allow to access my test.so library ?
2) if yes, which is the correct way to code this macro so that LibreOffice interpreter calls dlopen() or a equivalent system method ?

I understand that this request may appear basic but still I was unable to find a working example for Linux version of LibreOffice...

thanks for help.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2020-01-17 18:15:11 +0100

erAck gravatar image

Calling arbitrary shared objects' functions from Basic is, well, not implemented..

You could however call a Python script from Basic, or omit Basic altogether and use Python right on, and Python in turn could handle the shared object call. See https://help.libreoffice.org/6.4/en-U... and https://docs.python.org/3/library/cty...

edit flag offensive delete link more

Comments

thanks for help, before to start testing with LibreOffice BASIC (creating a xls page with some code) I have tested the library from Python and it works fine, unfortunatelly Python requires additional settings and I did hope that a simple solution (as that for LibreOffice windows) was available, from your comments it appears that the BASIC intepreter in Linux version doesn't allow to call shared libraries and I must look for alternatives...

gecos gravatar imagegecos ( 2020-01-17 18:32:49 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2020-01-17 17:36:44 +0100

Seen: 40 times

Last updated: Jan 17