Announcement
Collapse
No announcement yet.
compiler question
Collapse
X
-
AH, that's what those ifdefs I see are. Thanks for the explanation, finally puts it together for me.
-
Hey Scot,
This is basically how I compile a module, -D when I need to do or include something specific somewhere in the code, even inside a function. My tools module is a great example because it's actually a real module where I can be specific if the module is needed for a client build and don't want to include any prototype functions or functions that would never apply.Code:<MvCOMMENT>-SDS-- </MvCOMMENT> <MvIFDEF NAME="SOUTHBOUND"> Some specific code here </MvIFDEF>
With multiple -D capability, which I never realized available I can now do this:Code:mvc -D SOUTHBOUND -o ids_tools.mvc myproj.mv
This is the myproj.mv:Code:mvc -D SOUTHBOUND -D SHOWJSONVARS -o ids_tools.mvc myproj.mv
The compiler does a great job of telling what file and line # it detected an error.Code:<MvINCLUDE FILE="file1.mv"> <MvINCLUDE FILE="schedtasks.mv"> <MvINCLUDE FILE="core.mv"> <MvINCLUDE FILE="required.mv">
I haven't organized any project this way -- yet, but as you suggest, I will be considering using MvIFDEF in the project file in the future.
It's all very flexible. Flexibility is needed when I have many old projects that never had any organization and everything was a "make-from" based project. Also, IMO, there would be a lot of work with code and files and adjusting a MAKE File if I decided to try and use something that again. IFDEF and INCLUDES have made it easier to resurrect much of that older code and there is less re-inventing of the wheel. Still, are there better ways? Likely...
Scott
Leave a comment:
-
Scott, will you give me an example of a scenario in which you are using the -D flag to compile different code for different clients? Is it kind of like using the MvINCLUDE tag but having different sets of include files based on what you need for the particular integration?
Leave a comment:
-
Initially, it would be for debugging code. But, as I do more integration services, the module portion sometimes needs targeted code that is specific to the client. Instead of having multiple versions of the module, I use it to keep everything in one set of source code. I needed multiple symbols to be able to compile debug and/or targeted versions. I can then control what is compiled via batch files. For me, it's more straightforward than creating branches in a version control system for instance because it's usually not "core" functions that need to be included or not included in the compiled module.
Scott
- 1 like
Leave a comment:
-
Are you asking why as a use case or curiosity?
Thanks. Yes, I just realized, if you leave out the -D before the second symbol the compiler is looking for a folder that doesn't exist.
Scott
Leave a comment:
-
Why are you defining so many tokens in your program? The correct syntax would be mvc -D token1 -D token2 ... file.mv
Leave a comment:
-
for what its worth, none of my batch files I use for compiling have brackets around anything.
Leave a comment:
-
compiler question
I am not finding the compiler manual in the docs. Seems like it should be simple, but it really isn't explicit IMO.
I find I am using -D more and more.
What is the correct command line syntax?Code:mvc -D SYMBOL[-D ANOTHER_SYMBOL] source.mv
Is it:
orCode:-D sympbol1 symbol2
I've assumed the square brackets aren't included.Code:-D sympbol1 -D symbol2
Scott
Tags: None
Leave a comment: