Apache OpenOffice (AOO) Bugzilla – Issue 43536
DLL functions declared are only valid in the same module
Last modified: 2013-02-24 21:09:56 UTC
Hello, First of all, I refered by bug to the OO.o version 1.1.2, whereas it is the 1.1.4, but unfortunately the 1.1.4 is not available in the list ! When a DLL function is defined with "Declare", it is only usable in the same module. Calling it from other modules leads to an error "Undefined variable". To make it available in other modules, a workaround it to wrap the declared function in another "Sub" or "Function" in the same module. The new Sub or Function name is then available in other modules. ------------ First basic program in one module, which works: Option Explicit Declare Function VeeInitDll Lib "VeeGenApi.dll" () As Integer Sub Main Call VeeInitDll() End Sub ------------ The same program altered to have the DLL function declared in another module (it does not work, why ?) : Module1: Option Explicit Declare Function VeeInitDll Lib "VeeGenApi.dll" () As Integer Module2: Option Explicit Sub Main Call VeeInitDll() End Sub An error "Undefined variable" rises at the "Call VeeInitDll()" line. ------------ Workaround to the bug (?) by wrapping the DLL function : Module1: Option Explicit Declare Function VeeInitDll Lib "VeeGenApi.dll" () As Integer Function oo_VeeInitDll() As Integer oo_VeeInitDll = VeeInitDll() End Function Module2: Option Explicit Sub Main Call oo_VeeInitDll() End Sub ***** If it is not a bug the on-line help is unsufficient. Best regards. Guillaume Audirac
sw->ab: please have a look at this
Not so critical due to existing workaround but it's definetely wrong. -> OOo Later
It's a DUPLICATE of the issue #43436. Could you please change the status accordingly. Thanks. Guillaume
Set as duplicate of issue 43436 *** This issue has been marked as a duplicate of 43436 ***
close the duplicate