Issue 112064 - possibility to load shared librairies with "declare" command
Summary: possibility to load shared librairies with "declare" command
Status: CONFIRMED
Alias: None
Product: App Dev
Classification: Unclassified
Component: scripting (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: PC Linux, all
: P3 Trivial
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-03 09:05 UTC by hector3
Modified: 2019-03-09 21:41 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: 3.4.0
Developer Difficulty: ---


Attachments
Provide Declare Function on other operating systems (18.22 KB, patch)
2012-11-09 03:56 UTC, damjan
no flags Details | Diff
Provide Declare Function on other operating systems (21.41 KB, patch)
2012-11-09 03:59 UTC, damjan
damjan: review?
Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description hector3 2010-06-03 09:05:31 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
Comment 1 damjan 2012-11-01 04:24:21 UTC
This would be an interesting project. Currently "Declare Function ..." doesn't even compile on *nix, let alone run.
Comment 2 damjan 2012-11-09 03:56:40 UTC
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...
Comment 3 damjan 2012-11-09 03:59:39 UTC
Created attachment 79884 [details]
Provide Declare Function on other operating systems

New patch, containing other files too.
Comment 4 Heinrich Schuchardt 2015-04-28 19:37:45 UTC
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.
Comment 5 oooforum (fr) 2019-03-09 21:41:47 UTC
This issue is declared as DEFECT.
Should we set as PATCH with Damjan's job?