Issue 43536 - DLL functions declared are only valid in the same module
Summary: DLL functions declared are only valid in the same module
Status: CLOSED DUPLICATE of issue 43436
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: PC Windows 2000
: P3 Trivial
Target Milestone: ---
Assignee: ab
QA Contact: issues@api
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-25 11:24 UTC by audirac
Modified: 2013-02-24 21:09 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description audirac 2005-02-25 11:24:53 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
Comment 1 stephan.wunderlich 2005-03-01 12:54:17 UTC
sw->ab: please have a look at this
Comment 2 ab 2005-03-24 13:06:23 UTC
Not so critical due to existing workaround but it's definetely wrong.
-> OOo Later
Comment 3 audirac 2008-04-21 08:20:07 UTC
It's a DUPLICATE of the issue #43436.

Could you please change the status accordingly.
Thanks.
Guillaume
Comment 4 ab 2008-04-21 11:10:40 UTC
Set as duplicate of issue 43436


*** This issue has been marked as a duplicate of 43436 ***
Comment 5 Mechtilde 2008-11-05 20:33:04 UTC
close the duplicate