Creating modules

BlitzMax Forums/BlitzMax Programming/Creating modules

Yahfree(Posted 2008) [#1]
Hey, i'm trying to create a game engine module to throw all my useful code into, and just call routines from that.

I've taken a good look at a few modules i've downloaded and compiled, and even BRL's module, and some tutorials aswell.

Yet I'm having a problem!

This minimum code below is a test of my engine. To see if it compiles and everything:


SuperStrict

Rem
	bbdoc:	Yahfree's Game Engine
	about:	Handy functions stored in one place
EndRem
Module Yah.GE

ModuleInfo "Name: Yahfree's Game Engine"
ModuleInfo "Description: Useful code to reduce repetive junk"
ModuleInfo "License: Public Domain"
ModuleInfo "Authors: Yahfree"


Import BRL.Random
Import BRL.StandardIO


Rem
	bbdoc:	test function
	about:	Prints a random number between 10 and 20
	returns: Nothing
EndRem


Function ModTestFunction()

	Print Rand(10,20)

End Function


Sure enough, it compiles first time, the location of this GE.bmx is "BlitzMax/mods/Yah.mod/GE.mod"

Now I want to test it of course, so another minimal app to test it...:

Import Yah.GE

SeedRnd MilliSecs()
ModTestFunction()

End


Now I get an error?? what?? Does anyone know what I did wrong?

The error:

Compile Error
Can't find interface for module 'yah.ge'

Also strange: It doesnt show up on the right under third party modules.

Additional info:
I have all my MinGW system path vars set up, and the correct version as per the sticky in the Module Tweaks section of the forums.


slenkar(Posted 2008) [#2]
whats the filename of the BMX file in the mod folder?
did you press build modules?


Ked(Posted 2008) [#3]
Do you have the module files under "BlitzMax\mod\yah.mod\ge.mod\" ?


plash(Posted 2008) [#4]
If your mod name is ge.mod your bmx file will have to be named ge.bmx (I think...)
Also, you have to compile it using batch/command line or using "build modules" from your ide.


Yahfree(Posted 2008) [#5]
the file is located at:

"blitzmax\mod\yah.mod\ge.mod\ge.bmx"


and it was compiled using "CTR+D" in the Blitzmax IDE


Yahfree(Posted 2008) [#6]
Edit:

Just rebuilt the module, compiled perfectly again, but the test source is not working - same error

Compile Error: Can't find interface for module 'yah.ge'



plash(Posted 2008) [#7]
No clue whats wrong there then.


Yahfree(Posted 2008) [#8]
Not good :\...

Any suggestions?


plash(Posted 2008) [#9]
What is the output for building the module? Are there .a and .i files in the mod folder?


Yahfree(Posted 2008) [#10]
>Are there .a and .i files in the mod folder?

There's two .a files in the same directory, and Bmax made a folder in that directory with some .i files, .o files, and .s files.

>What is the output for building the module?

Building Modules
Compiling:GE.bmx
flat assembler  version 1.66
3 passes, 1005 bytes.
Archiving:GE.debug.win32.x86.a
ar: creating C:/Programing/BlitzMax/mod/Yah.mod/GE.mod/GE.debug.win32.x86.a
Compiling:GE.bmx
flat assembler  version 1.66
3 passes, 623 bytes.
Archiving:GE.release.win32.x86.a
ar: creating C:/Programing/BlitzMax/mod/Yah.mod/GE.mod/GE.release.win32.x86.a

Process complete



DavidDC(Posted 2008) [#11]
Just a guess - but I struck something similar a long time ago and I think I fixed it by converting all module names to lower case. Worth a try anyway.


Yahfree(Posted 2008) [#12]
>Just a guess - but I struck something similar a long time ago and I think I fixed it by converting all module names to lower case. Worth a try anyway.

HOLLALUA!! that worked! sweet, bizzar though.


Now on to figuring out why my code won't highlight -.-


DavidDC(Posted 2008) [#13]
:-)


Yahfree(Posted 2008) [#14]
Hey, any reason why it's not showing up under third party modules?


Edit: I cant seem to find any documentation on it wierd?


plash(Posted 2008) [#15]
Try putting your bbdoc directly above your function/type/method etc..
Rem
bbdoc: Audio sound type
End Rem
Type TSound
...
Rem
bbdoc: Set playback volume of an audio channel
about:
@volume should be in the range 0 (silent) to 1 (full volume)
end rem
Function SetChannelVolume( channel:TChannel,volume# )



Yahfree(Posted 2008) [#16]
still no effect... hmmm


Yahfree(Posted 2008) [#17]
here's one of my functions for example:

Rem
bbdoc: Particle count function
about: Returns the particle count
returns: The particle count
End Rem
Function ParticleCount:Int()
	Return ParticleList.Count()
End Function



plash(Posted 2008) [#18]
Program->Rebuild Documentation (maxide)


Brucey(Posted 2008) [#19]
Writing modules now, eh? Excellent :-)

Took your code from the top post, and the function doesn't appear in the docs.. although the module does. As Plash says, your doc comment needs to be above the function without any blank lines.
Changing your code to match, the function now appears in the documentation for your module and becomes syntax coloured when typed into the IDE.

Have you run "Rebuild Documentation" ? :-p
<edit>Like what Plash said above ;-)


Yahfree(Posted 2008) [#20]
*Facepalm*

Thanks

Edit: Awsome! syntax highlighting, everything, nicely done