Calling another sub in Static Code Module

WZSun

Member
Licensed User
Longtime User
Hi,
I'm testing v1.15

I tried putting common Subs into the Code module. Most works fine except I noticed if I have a Sub that calls another Sub stored in the Code module, there is an error. However, if I move the second Sub to the activity page, it works fine.

For example, I may have a Sub in Code module say, StringParse.
Then I have another Sub in the same Code module say, GetMonthNum

In many case, the GetMonthNum would display an error pointing it to the line that calls the StringParse

But if I move GetMonthNum to say, Activity1 page, it works well.

Anyone having similar problem?
 

agraham

Expert
Licensed User
Longtime User
Yes :(
B4X:
Sub CodeSub
   ToastMessageShow("Called CodeSub in Code module", False)
   CodeSub2
End Sub

Sub CodeSub2
   ToastMessageShow("Called CodeSub2 in Code module", False)
End Sub
I get a B4A compile error

Error compiling programs
Error description: Syntax error (missing parameter).
Occurred on Line: 12
CodeSub2
Word: CodeSub



All the Subs in the Code module are being compiled with an additional parameter of type BA for reasons that I can understand but won't try to explain here. The internal calls don't pass this parameter and so fail.

public static String __codesub2(anywheresoftware.b4a.BA _ba)
 
Top