| View previous topic :: View next topic |
| Author |
Message |
Guillaume Audirac Newbie

Joined: 21 Feb 2005 Posts: 4
|
Posted: Tue Feb 22, 2005 6:25 am Post subject: Declare DLL does not work in a different module |
|
|
Hello,
Here is my piece of program :
Option Explicit
Declare Function VeeInitDll Lib "VeeGenApi.dll" () As Integer
Sub Main
Call VeeInitDll()
End Sub
It works well in this case.
Then, because I have to declare several long functions of my DLL, I separate the Declare and the Main program in 2 different modules :
Module1:
Option Explicit
Declare Function VeeInitDll Lib "VeeGenApi.dll" () As Integer
Module2:
Option Explicit
Sub Main
Call VeeInitDll()
End Sub
Then I run Main in Module2, with the error message "Undefined variable" at the "Call VeeInitDll()" line.
What does this mean ? Is there really an error or is it a bug ?
Thanks a lot for your help !
Guillaume Audirac |
|
| Back to top |
|
 |
ms777 Super User


Joined: 07 Feb 2004 Posts: 1355
|
Posted: Tue Feb 22, 2005 9:19 am Post subject: |
|
|
In principle, your approach should work. I have the DECLARE statement in the OO standard Library, and can call it from any Module I want (OO1.1.3)
Maybe the syntax checking is more strict with DECLARE functions ? Did you try
| Code: | Dim u as long
u = VeeInitDll()
|
|
|
| Back to top |
|
 |
ms777 Super User


Joined: 07 Feb 2004 Posts: 1355
|
Posted: Tue Feb 22, 2005 9:28 am Post subject: |
|
|
Oops, I have to correct myself. Just looked again into the code - I have written wrapper functions around the DECLARED functions to be able to call them from other modules. So it seems to be a bug (or a safety feature ? ) |
|
| Back to top |
|
 |
Cybb20 Super User


Joined: 02 Mar 2004 Posts: 1569 Location: Frankfurt, Germany
|
|
| Back to top |
|
 |
Guillaume Audirac Newbie

Joined: 21 Feb 2005 Posts: 4
|
Posted: Tue Feb 22, 2005 11:38 pm Post subject: |
|
|
The link you propose is not related to the same problem.
And I agree with the post before : to make it working properly, I need to wrap my Declare function with another function in the same Module. Then the new name can be called in any module. Strange, isn't it ?
New version which works :
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
So, is it a bug or intentional ?
Guillaume Audirac |
|
| Back to top |
|
 |
hector General User

Joined: 11 Apr 2004 Posts: 6 Location: France
|
Posted: Thu Aug 27, 2009 3:36 pm Post subject: |
|
|
| I would rather say it is a bug, and it seems to be still present in openoffice 3.1 ... |
|
| Back to top |
|
 |
|