Powerbuilder 11, calling VB6 DLL failing on array variable

Posted on 2008-06-23
Last Modified: 2013-12-26
I have a small VB 6 DLL that I'm creating to house a complex calculation already written in VB6.  I'm calling it from Powerbuilder 11.1.  I can get the two to interact successfully, passing doubles, returning doubles, doing bogus calculations within the VB DLL.  However, as soon as I incorporate an array variable in the VB code, Powerbuilder returns an error when trying to call the function.  

The actual calculations uses many array variables, some multi-dimensional, which it loops through for various computations.  

Why is this failing on the array variable?

'For example, this VB code works

Public Function GetValue(ByVal x as double, ByVal y as double) as double

Dim Z as double


End Function


'This VB code will fail when called from PB 11

Public Function GetValue(ByVal x as double, ByVal y as double) as double

Dim Z(1) as double


End Function


Open in new window

Question by:erika9star
  • 3
  • 2
LVL 26

Expert Comment

ID: 21854492

you have not use Z variable from anywhere

Author Comment

ID: 21855245
True.  And yet it still causes a failure, even with only a declaration of the variable.  If I can't declare an array, I certainly can't use one.
LVL 26

Expert Comment

ID: 21855525
don't know much about Powerbuilder, do they use base 1 or base 0

if 1 then you may wan to add

Option Base 1

have you also tried

Dim Z() as double

redim Z(1)

Author Comment

ID: 21858616
PB uses base 1.  

I have tried dim and redim.  No luck there either.

I've found that the VB "On Error Goto ... " Statements seem to be causing a function call failure as well.  It looks as if I'll be trying a different route.

Accepted Solution

erika9star earned 0 total points
ID: 21858638
I'm rewriting the VB code into PowerBuilder.  Not my preferred solution, but it'll have to do.

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now