Building more than one module

BlitzMax Forums/BlitzMax Programming/Building more than one module

REDi(Posted 2007) [#1]
Max seems to be building modules in alphabetical order which is causing problems for me atm, for example if you create two empty (uncompiled) modules and one of those modules imports the other like so...

"example.mod/b.mod" imports example.a - all works fine because a.mod gets compiled first.

But if "example.mod/a.mod" imports example.b - then I get "unable to find interface" error because b.mod hasnt been compiled yet.

Perhaps the easiest way around this would be to have a optional file to list the required compile order?


Brucey(Posted 2007) [#2]
From what I've found, BlitzMax compiles required modules in order, with the top-level module in a hierarchy compiled last.

I get this :
Building Modules
Compiling:b.bmx
flat assembler  version 1.66
3 passes, 443 bytes.
Archiving:b.debug.win32.x86.a
Compiling:a.bmx
flat assembler  version 1.66
3 passes, 486 bytes.
Archiving:a.debug.win32.x86.a

where a looks like :
module example.a

import example.b


Looks good from here.


REDi(Posted 2007) [#3]
Brucey, yeah thats what I thought, I just tried to replicate it myself and failed. (sorry I should have tried example before posting!)

There must be something else strange going on.

It was first reported by gregbug in this thread... http://www.blitzmax.com/Community/posts.php?topic=74048 and I had the same problem after deleting all the i and a files and rebuilding. I renamed one of the mods to amusic and it all compiled fine.

I dont think it could have been due to circular imports, because I didnt change what ones were actualy imported, just renamed one.

I'll have a play around later tonite and see if I can replicate it again.


REDi(Posted 2007) [#4]
I've just uploaded a version of maxmod the produces the error... http://maxmod.googlecode.com/files/maxmod_builderror.zip


Building Modules
Compiling:audiostream.bmx
Compile Error: Can't find interface for module 'maxmod.music'
[C:/Program Files/BlitzMax/mod/maxmod.mod/audiostream.mod/audiostream.bmx;20;1]
Build Error: failed to compile C:/Program Files/BlitzMax/mod/maxmod.mod/audiostream.mod/audiostream.bmx
Process complete



but if I rename maxmod.music to maxmod.amusic it compiles fine O.o


Building Modules
Compiling:amusic.bmx
flat assembler version 1.66
3 passes, 6473 bytes.
Archiving:amusic.debug.win32.x86.a
Compiling:audiostream.bmx
ar: creating C:/Program Files/BlitzMax/mod/maxmod.mod/amusic.mod/amusic.debug.win32.x86.a
flat assembler version 1.66
3 passes, 21826 bytes.
Archiving:audiostream.debug.win32.x86.a
Compiling:modplayer.bmx
ar: creating C:/Program Files/BlitzMax/mod/maxmod.mod/audiostream.mod/audiostream.debug.win32.x86.a
flat assembler version 1.66
5 passes, 78350 bytes.
Archiving:modplayer.debug.win32.x86.a
ar: creating C:/Program Files/BlitzMax/mod/maxmod.mod/modplayer.mod/modplayer.debug.win32.x86.a
Compiling:sidstream.bmx
flat assembler version 1.66
4 passes, 15247 bytes.
Archiving:sidstream.debug.win32.x86.a
ar: creating C:/Program Files/BlitzMax/mod/sid.mod/sidstream.mod/sidstream.debug.win32.x86.a
Compiling:amusic.bmx
flat assembler version 1.66
3 passes, 6473 bytes.
Archiving:amusic.release.win32.x86.a
Compiling:audiostream.bmx
ar: creating C:/Program Files/BlitzMax/mod/maxmod.mod/amusic.mod/amusic.release.win32.x86.a
flat assembler version 1.66
3 passes, 21826 bytes.
Archiving:audiostream.release.win32.x86.a
Compiling:modplayer.bmx
ar: creating C:/Program Files/BlitzMax/mod/maxmod.mod/audiostream.mod/audiostream.release.win32.x86.a
flat assembler version 1.66
5 passes, 78350 bytes.
Archiving:modplayer.release.win32.x86.a
ar: creating C:/Program Files/BlitzMax/mod/maxmod.mod/modplayer.mod/modplayer.release.win32.x86.a
Compiling:sidstream.bmx
flat assembler version 1.66
3 passes, 6939 bytes.
Archiving:sidstream.release.win32.x86.a
ar: creating C:/Program Files/BlitzMax/mod/sid.mod/sidstream.mod/sidstream.release.win32.x86.a

Process complete




Brucey(Posted 2007) [#5]
Found it...

You have :

?NoDebug

Remove the "?"

so :

NoDebug

... and all should be well :-)

Works for me when I take it out. (well, bar an error about parameters, but it's compiling in the right order now).

HTH

:o)


REDi(Posted 2007) [#6]
Nice one Brucey, you're a legend! :)

Still odd that it works when its renamed to amusic.
So is it not a compiler directive anymore?

what error about params? you still using 1.26 or something?


Brucey(Posted 2007) [#7]
you still using 1.26 or something?

Yeah... on the work's PC... don't mind me :-)

Still odd that it works when its renamed to amusic.

Actually, what's happening is the "?" is like the start of a block, but BMK skips searching for Imports to the end of that block - which doesn't exist. Therefore it doesn't see that there are any Imports to import, and that's why when you change the order by renaming it, things appear to work.
BMK just makes sure things are built, while bcc actually tries to link them together...

;-)


REDi(Posted 2007) [#8]
Cool, Thanks Brucey!