Sub in Module not accessible

FFMan

Member
Licensed User
Longtime User
I had a sub in the main program that i moved to a newly added module.

When i compile I get an error as the compiler thinks my sub program name referenced in the main module is a variable not a sub in the new module. The compiler doesn't appear to 'see' the newly moved sub.

Do i need to declare subs in the main program some how ?

Where have I gone wrong ?

thanks
 
this is the sub

'An NMEA checksum is calculated as the XOR of bytes between (but not including) the dollar sign and asterisk.
Sub NMEA_Checksum(sentence As String) As String
Dim s As String
Dim i As Int
Dim sum(1) As Byte

'Log("NMEA passed:" & sentence)
s = sentence.Trim

sum(0)=0
For i = 0 To s.Length-1
sum(0) = Bit.Xor(sum(0),Asc(s.SubString2(i,i+1)))
Next

'debug.print "Chk=";CstrHex(sum)
Return conv.HexFromBytes(sum)
End Sub

the name is right - i cut and paste. was zbasic code once upon a time
 
Upvote 0
thanks thats fixed it

i couldn't fund this documented anywhere - where should i look ? i have the helpfinder and the beginners guide.
 
Upvote 0
Upvote 0
thanks thats fixed it

i couldn't fund this documented anywhere - where should i look ? i have the helpfinder and the beginners guide.

Check out the Documentation Wiki which says:

the module name must be added when calling a sub, such as a line in Main calling a sub (Sub1) in Mod1: Mod1.Sub1.

In addition to the information in the Wiki, it has links to the Module tutorials.
 
Upvote 0
Back
Top