If I have a macro declared as public in file1.bas (ie 'public macro mymac()'), if I include file1.bas in other files should I be able to reference the macro with the same syntax used for other public entities (ie 'file1.mymac')?
To make it clearer, I have a module with a macro in it:
mymacro.bas
Code: Select all
module mymac
public macro mymacro(param1, param2)
param1 = param2
end macro
end module
mod1.bas
Code: Select all
module mod1
// has macro definition
include "mymacro.bas"
dim a, b as byte
public sub initialize()
b = 0
mymac.mymacro(a, b)
end sub
end module
mod2.bas
Code: Select all
module mod2
// has macro definition
include "mymacro.bas"
dim a, b as byte
public sub initialize()
b = 0
mymac.mymacro(a, b)
end sub
end module
and my main routine:
main.bas
Code: Select all
program test
device = 18F4685
clock = 40
include "mymacro.bas"
include "mod1.bas"
include "mod2.bas"
dim a, b as byte
b = 0
mod1.initialize()
mod2.initialize()
mymac.mymacro(a, b)
It seems happy if I get rid of the mymacro.bas file and just place a private local copy of the macro in each of the files, but I was trying to get away from that.
Am I using it incorrectly?