Project file

Discussion about the ZBasic language including the System Library. If you're not sure where to post your message, do it here. However, do not make test posts here; that's the purpose of the Sandbox.
Post Reply
rich
Posts: 81
Joined: 19 November 2015, 12:23 PM

Project file

Post by rich »

The files to be compiled are entered into the project file but do they need to be module files or could they just be files with code in them?

Thanks
Richard
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: Project file

Post by dkinzer »

rich wrote:[...]could they just be files with code in them?
Any file containing ZBasic code (subroutines, functions, data declarations, etc.) is considered to be a module. (And, by the way, you can't have ZBasic executable statements that are not contained within a subroutine or function.) The module containing the Main() subroutine is considered to be the main module and must be first on the list of files to compile.

If need be, you can also include C and AVR assembly language files in the project file when compiling for a native mode target device. Generally speaking, those files should be named in the project file after all of the ZBasic code files. You could intermix the C and assembly language files with the ZBasic code files but there is no good reason to do so.

To summarize, the project file may consist of the following elements (generally speaking, in the order mentioned below):
  • * optionally, compiler directives and compiler options
    * ZBasic modules (of which the main module must be first)
    * optionally, C and/or AVR assembly language files
- Don Kinzer
rich
Posts: 81
Joined: 19 November 2015, 12:23 PM

Post by rich »

Now i know my misunderstanding.
I thought that "module" was a key word.

However it sounds like it is just a file with code in it and the first file in the list must have the sub main in it.

Is this correrct?
richard
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

rich wrote:I thought that "module" was a key word
Actually, it is. For compatibility with Visual Basic, you can specify the keyword Module followed by the module name. However, since that module name must match the module name derived from the filename, it serves no useful purpose.
rich wrote:it sounds like it is just a file with code in it and the first file in the list must have the sub main in it.
That is correct. Section 2.3 of the ZBasic Reference Manual describes what modules are.

www.zbasic.net/doc/ZBasicRef.php?page=18
- Don Kinzer
Post Reply