?
Solved

Expresion too complex error in VB6

Posted on 2008-10-17
7
Medium Priority
?
1,161 Views
Last Modified: 2013-11-26
Hi all,

I have an aplication written in VB6 that in which I'm testing a linear equations solver implemented in a standard DLL in C. If I run the code not using the DLL (using the traditional solver in VB) the code runs well, but if I use the DLL, the software returns an "Expression too complex" error, interestingly enough, on another completely different part of the code. The C DLL is a straight translation from the original code, and, to add a little fun, this happens on one PC but nor in another, both using exactly the same version of VB (down to the service pack), Windows, and solver DLL. Have anybody seen anything like this?

Best regards


0
Comment
Question by:interfaces
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 6

Expert Comment

by:mirzas
ID: 22740993
Is the OS same on both machines?

What about regional settings?

You'd be surprised.
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 22741003
>> but if I use the DLL, the software returns an "Expression too complex" error
is this a runtime error? or at compile time when you try to build the DLL?
0
 

Author Comment

by:interfaces
ID: 22743340
Hi Jaime,

It's a runtime error.

Cheers,

Miguel
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:interfaces
ID: 22743352
Hello mirzas,

Regional settings, and OS versions are the same.

Regards,

Miguel
0
 
LVL 6

Expert Comment

by:mirzas
ID: 22755889
Here is a quote from the VB reference:


Visual Basic Reference: Error Messages
Expression too complex

A floating-point expression contains too many nested subexpressions.
To correct this error

    * Break the expression into as many separate expressions as necessary to prevent the error from occurring.


Now as for the different behavior on different machines.. there MUST be something that IS different between them.
Since you're using VB I do not see how hardware differences could cause this problem.
So it must be the software.
0
 

Author Comment

by:interfaces
ID: 22759741
I was finally able to narrow the problem a bit. It seems that the calculation code (VB) is consuming too many resources. If I let the program run without doing anything else, It carries on ok, but If I try to do something else, the "Expression too complex" error occurs. On one PC the error happens under these circumstances, but on the other it happens every time. I guess I'll have to re-write all the equations in a more step-by-step mode, and see If i can get rid of the error.
0
 

Accepted Solution

by:
interfaces earned 0 total points
ID: 22797995
Well, I found the problem

The function in the DLL was declared as returning a float value, but in the VB6 Client app, it was declared as a Sub. Changing the declaration in the DLL to void solved the problem.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
Suggested Courses
Course of the Month9 days, 16 hours left to enroll

762 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