How to create/compile a module ?

Monkey Forums/Monkey Programming/How to create/compile a module ?

BurpyMcFistyGuts(Posted 2014) [#1]
How do you create/compile a module - I just get the usual "Function Main not found"


ziggy(Posted 2014) [#2]
You do not compile modules in Monkey. Modules source code is just joined to regular code when you do compile an App that uses the module, so no need to compile them separately.

That said, you should know that Monkey does only compiles really used code. It has a very very efficient dead code removal. So, if any part of your module is not being actually used by the app you're compiling, it won't be compiled. That means that potential syntax error won't be detected.


BurpyMcFistyGuts(Posted 2014) [#3]
The other problem is that my base program can't find the module code - it keeps wanting to look in the base program directory and not .mod

Solved it - the module name was in quotes...


ziggy(Posted 2014) [#4]
Yes, Import with quotes is meant to be used to copy elements to the data folder. It's used by Mojo to copy the DrawText bitmap font into the Apps data folders (just as an example). In order to import modules, just use the module name.


Gerry Quinn(Posted 2014) [#5]
Never knew about import with quotes. It's a nice option if you are aiming at a bunch of targets and you hate the idea of including extraneous resources!