Re: Procedure is too large.
VB.Net has no such subroutine code size limitation as it's modern recently to compare. . .
Just kidding of course :-))
I've heard the 64k lines per module limit being hit but this IDE (debugger?) limit sounds like something else might be at play.
Do you use
If Not Not MyArray Then
. . . hack to test for empty arrays perhaps?
cheers,
</wqw>
Re: Procedure is too large.
Quote:
Originally Posted by
wqweto
VB.Net has no such subroutine code size limitation as it's modern recently to compare. . .
Just kidding of course :-))
I've heard the 64k lines per module limit being hit but this IDE (debugger?) limit sounds like something else might be at play.
Do you use
If Not Not MyArray Then
. . . hack to test for empty arrays perhaps?
cheers,
</wqw>
nah, it is just the main command interpreter sub, it has a kilometer huge SELECT CASE CommandID .... and then like 400+ "CASE IS =" CommandConstantID
and the problem yesterday was that I had to simulate the server in debug mode to run with the database from a customer and see what the hell was happening right there (an emergency technical support session). I failed to understand quickly because the code was full of several "procedure too large" everywhere that prevent to simulate the server in debug mode. The customer wasn't happy, as he wasn't unable to run his business all the morning.
Re: Procedure is too large.
I had exactly the same problem.
So I split the Select case in several sub function called :
Select Case
Case 1
...
Case Else
Call Sub1
End Select
etc...
Re: Procedure is too large.
Quote:
Originally Posted by
Thierry69
I had exactly the same problem.
So I split the Select case in several sub function called :
Select Case
Case 1
...
Case Else
Call Sub1
End Select
etc...
yes, I did the same, so, right now it is prepared. But hell, I had to split it in 5 parts., 4 parts wasn't enough.
So, wondered how can be that it has a limit!.
Re: Procedure is too large.
This generates code that compiles and can be debugged ok:
Code:
Option Explicit
Private Sub Form_Load()
Dim sCode As String
Dim lIdx As Long
sCode = sCode & "Private Sub Test(ByVal lParam As Long)" & vbCrLf
sCode = sCode & " Select Case lParam" & vbCrLf
For lIdx = 1 To 1000
sCode = sCode & " Case Is = " & lIdx & vbCrLf
sCode = sCode & " Debug.Print " & lIdx & vbCrLf
Next
sCode = sCode & " End Select" & vbCrLf
sCode = sCode & "End Sub" & vbCrLf
Clipboard.Clear
Clipboard.SetText sCode
MsgBox "Sub Test() generated to clipboard", vbExclamation
End Sub
cheers,
</wqw>
Re: Procedure is too large.
Quote:
Originally Posted by
wqweto
This generates code that compiles and can be debugged ok:
Code:
Option Explicit
Private Sub Form_Load()
Dim sCode As String
Dim lIdx As Long
sCode = sCode & "Private Sub Test(ByVal lParam As Long)" & vbCrLf
sCode = sCode & " Select Case lParam" & vbCrLf
For lIdx = 1 To 1000
sCode = sCode & " Case Is = " & lIdx & vbCrLf
sCode = sCode & " Debug.Print " & lIdx & vbCrLf
Next
sCode = sCode & " End Select" & vbCrLf
sCode = sCode & "End Sub" & vbCrLf
Clipboard.Clear
Clipboard.SetText sCode
MsgBox "Sub Test() generated to clipboard", vbExclamation
End Sub
cheers,
</wqw>
I don't think it has to do with lines-count, maybe the compiler inside the IDE has a primitive limit about space in RAM for each procedure. Or maybe it is the same that in compile mode, but in debug mode the code INFLATES inserting breaks allowing the step by step. What I can tell is that running the program in the IDE (F5) it performs way slower than the compiled EXE. Anyway, what a hasle!.
Re: Procedure is too large.
I think Flyguille is right.
For example, in my source, I add automatic line number and remove them if needed (automatic qith VBIDEUtils), (this is for the error handling)
When I faced this problem, when I had the line numbers, and if I removed them, it was working (untill a certain time)
Re: Procedure is too large.
A select case with hundreds of cases, which all have to be evaluated can be handled a little bit smarter using ranges
If the ID is 233 then 233 compares have to be done
Code:
Select Case ID
Case 1
Case 2
..
Case 100
..
Case 200
..
Case 233
..
End Select
Using this method a maximum of 100+3 case have to be done
Code:
Select Case ID
Case 1 to 99: SubSelect000(ID)
Case 100 To 199: SubSelect100(ID)
Case 200 To 299: SubSelect200(ID)
End Select
Re: Procedure is too large.
The limit is probably caused by the VM handler (a procedure descriptor holds the size of a procedure in a 2-byte field).
Re: Procedure is too large.
I had this problem with M2000 Interpreter. The solution is simple. Just create some subs and just call them instead using inline code.