After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 597849 - Adapter plugin to load genuine Excel addins (XLLs)
Adapter plugin to load genuine Excel addins (XLLs)
Status: RESOLVED FIXED
Product: Gnumeric
Classification: Applications
Component: import/export MS Excel (tm)
git master
Other All
: Normal enhancement
: ---
Assigned To: Jody Goldberg
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2009-10-08 19:32 UTC by pj
Modified: 2010-02-02 19:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gnumeric+goffice patch to add proposed functionality. (122.71 KB, patch)
2009-10-08 19:32 UTC, pj
none Details | Review
gnumeric+goffice patch to add proposed functionality. (122.83 KB, patch)
2009-10-09 18:18 UTC, pj
none Details | Review
Updated patch that is now also working ant tested on WIN32 (123.92 KB, patch)
2009-10-10 00:46 UTC, pj
none Details | Review
gnumeric patch for XLL loading - this version uses GnmFuncEvalInfo pointer to determine which XLL function to call at run time. (124.58 KB, patch)
2009-10-10 14:16 UTC, pj
none Details | Review
Update of patch to accommodate changes to code base since last submission. (123.96 KB, patch)
2009-12-14 18:53 UTC, pj
none Details | Review

Description pj 2009-10-08 19:32:15 UTC
Created attachment 145066 [details] [review]
gnumeric+goffice patch to add proposed functionality.

I developed a patch against the currrent GIT head (at the time of writing,
2009-10-08) that enables Gnumeric to load genuine Excel plugins (XLLs).

The module can load XLLs that register in Excel via the Excel4 or the Excel4v
interface as described in the Excel SDK (version 5, for instance). It only
works for worksheet functions which only take arguments of Excel SDK type 'P'
or 'R' (XLOPER), and return an argument of the same type. The adapter module is
called excelplugins and searches its own plugin directory, and recursively all
directories below, for any shared module that it can load, and that provides
the xlAutoOpen initialisation function, as is customary for XLLs.

The new module has two potential uses:

1) Users who have their own XLL development code can recompile it under, say,
Linux into a native shared object, but without any interface changes. The Linux
Gnumeric plugin (excelplugins) then loads it if it is found under the
excelplugins directory. Of course, the directory that is searched could be
changed.

The code is reasonably well tested on Linux in the above described
circumstances.

2) For the Windows build, the code is meant to be able to load existing XLLs as
long as they register via Excel4/Excel4v, provide xlAutoOpen, and only exchange
data via XLOPER type ('P' or 'R', but note that worksheet references etc are
not supported).

The Windows code is as yet untested, but due to the fact that almost all of the
code is completely generic, it is unlikely that many bugs will surface during
the testing of the Windows code, which I am working on.


The patch consists of two parts: a small (~10 lines) patch to GOFFICE, and a
larger patch (~122k) patch to GNUMERIC. Since only one attachment is permitted,
I concatenated them.

The main part of the patch is the file
gnumeric/plugins/excelplugins/excelplugins.c which contains large amounts of
documentation about the methodology.
Comment 1 pj 2009-10-09 18:18:40 UTC
Created attachment 145164 [details] [review]
gnumeric+goffice patch to add proposed functionality.
Comment 2 pj 2009-10-10 00:46:39 UTC
Created attachment 145194 [details] [review]
Updated patch that is now also working ant tested on WIN32

I have now been able to test the proposed code with a WIN32 build (cross-built on Linux) running on native Windows XP. Only minor changes were required to make it work.

This means that this code is now ready for release. It may still be desirable to add other loading locations - at the moment, the plugin only loads XLLs that are in the same directory as the excelplugins module, or in any subdirectory. This should be straightforward for anyone who wishes to do it since the search routine is cleanly separated from the load mechanism.
Comment 3 Jody Goldberg 2009-10-10 13:09:53 UTC
goffice portion reviewed and committed.
Comment 4 pj 2009-10-10 14:16:00 UTC
Created attachment 145212 [details] [review]
gnumeric patch for XLL loading - this version uses GnmFuncEvalInfo pointer to determine which XLL function to call at run time.

The code has been simplified to use the GnmEvalFunctionInfo * ei pointer provided at run time to look up the name, ei->func_call->func->name, in a map that is created at time of go_plugin_init(), to determine which XLL function to call. This obviates the need for generation of executable code at run time by the aid of mmap/VirtualProtect. The new code is free of any techniques that could pose any portability issue.

The new patch is only for Gnumeric since Jody Goldberg confirmed that the Goffice part of the patch is already committed at the time of writing.
Comment 5 pj 2009-12-14 18:53:01 UTC
Created attachment 149719 [details] [review]
Update of patch to accommodate changes to code base since last submission.
Comment 6 Morten Welinder 2010-02-02 19:39:15 UTC
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.