Apache OpenOffice (AOO) Bugzilla – Issue 112064
possibility to load shared librairies with "declare" command
Last modified: 2019-03-09 21:41:47 UTC
It is possible with OS system windows to load a dynamic library (*.dll) with the "Declare" command, in a Basic scripting. Equivalently, It should be possible to declare a shared library (*.so) on a linux OS. Thanks
This would be an interesting project. Currently "Declare Function ..." doesn't even compile on *nix, let alone run.
Created attachment 79883 [details] Provide Declare Function on other operating systems Here is a patch that uses Dyncall (http://dyncall.org) to implement "Declare Function" on non-Win32 operating systems. It has a number of limitations, such as no support for arrays or structs, because Dyncall doesn't support those. I've also changed string marshalling to marshal back as many bytes as went through. This is what Visual Basic does (http://support.microsoft.com/kb/175512/EN-US) and it's the only way to implement functions like GetLogicalDriveStringsA properly. Also in the marshal() function, I've commented out the code that always marshals strings by value unless VBA is enabled. Integration with the build system could use some improvement - currently Dyncall has to be installed for AOO to compile...
Created attachment 79884 [details] Provide Declare Function on other operating systems New patch, containing other files too.
Building OpenOffice creates ./main/python/unxlngx6.pro/misc/build/Python-2.7.6/Modules/_ctypes/libffi Obviously OpenOffice already depends on libffi. So using this library for dynamically calling functions should be preferable to introducing dyncall as a new dependency.
This issue is declared as DEFECT. Should we set as PATCH with Damjan's job?