Modules in Projects
Spire_Jeff
Posts: 1,917
Is there a way to for NS4 to ONLY use the modules that are listed in the module section of the system being compiled? I just spent the better part of two hours troubleshooting a problem that may or may not be a problem because I forgot to change the module declaration statement. Only the two modules I am testing are part of the system, but they are in the same folder as the original modules. The compiler in it's infinite wisdom just found the modules in the declaration by searching, and I totally missed this (which makes it clear why everything I was trying wasn't working ).
Maybe we don't have to go so far as preventing the compiler from doing this, but maybe just add some warnings. I am thinking there should be a warning when the compiler uses a module not defined in the Modules section. There should also be a warning if there are unused module in the project. This might not be a bad idea for all of the sections.
Jeff
Maybe we don't have to go so far as preventing the compiler from doing this, but maybe just add some warnings. I am thinking there should be a warning when the compiler uses a module not defined in the Modules section. There should also be a warning if there are unused module in the project. This might not be a bad idea for all of the sections.
Jeff
0
Comments
The compiler can only go by what?s been declared in code. You can drop dozens of modules in the project but only the ones that have been declared in code will be compiled. You can also put dozens of include files in the project but only the ones that #include in code will be compiled. You can also go the opposite route and put nothing in the workspace or not even have a project workspace at all (which drives me crazy) but if there are modules or #includes declared in code and if they can be found in the search path then they will compile.
Where it searches is a different matter and can be argued but what it actually searches for can only be determined by what?s declared in code.
I?m not against any type of suggestion for warnings to help us in our work but I do think that the only way the compiler can (and should) do its job is by what we?ve declared in code.
nope, not true.
it compiles everything you put in the "Module" section of your workspace, even if it's not declared using DEFINE_MODULE.
In my case, it doenst even compile modules that are not in my "Module" workspace bit, but are declared in code using DEFINE_MODULE
i don't know the command line compiler parameters, but i'm guessing you have to pass a reference to the modules you are using...
I usually use ?compile as Netlinx? because it takes less time. If I?m working on a module then I ?compile as Nelinx.? If I?m working on the main program then I also do a ?compile as Netlinx? because ?build active system? just recompiles what?s already been compiled before (assuming the .axs version of the module is in your project) Once there is a .tko for a module there is no need to recompile the module unless you are changing the module. The .output from a module (the .tko) gets linked into the final product (the .tkn) if the module is declared in the program.
That's my story and I'm sticking to it.
i'm not saying you aren't right. I'm just saying my output window tells something else (for me )
I'm with Joe on this one...compile only what you need to compile.
Not only does it take more time, needless recompiling of unchanged modules continues to reset the date of the .tko file. If the module has not changed, why recompile it? In fact, I typically add only the .tko file of any module to my workspace unless I intend to edit the source file.
Even if this can't be done during the compile process, maybe they could add a project report that scans the active code and lists any files in the workspace that aren't being used. It could also list all of the includes and modules that are being used along with their path.
I believe that a file export already does some of this reporting, so it should be feasible.
Jeff
A little insight on how the NetLinx compilation process actually works within NS2:
1) Selecting to "Build System" will compile and link ALL the AXS files that are part of the MODULE and SOURCE folders within the SYSTEM.
2) Selecting to "Compile as NetLinx" will only compile the AXS file that is currently in focus within the editor. Or if you have right-mouse clicked on a file within the workspace, you can compile only that selected AXS file.
3) The following is the look-up order that the compiler uses to find your defined modules during the link phase:
1 - Path of the "Master" AXS file as defined within your SYSTEM.
2 - All paths that are found from the AXS files that are part of your MODULE and SOURCE folders of SYSTEM.
3 - Directory definitions found under "Module Files" located on the NetLinx Compiler tab within the "Preferences" dialog.
4) Same order applies above when the compiler needs to find your "Include" files, with the "Include Files" directories definitions being used in step 3 above instead of the "Module Files" directories.
If you have a SYSTEM with 200 modules, but your Main program only requires 3 modules to link, all 200 modules will compile, but the resulting TKN will only contain the byte-code for the 3 required modules (i.e. the TKN will not be bloated with unneeded module code).
Hope this helps...or maybe it adds to the confusion...:)
This has caused me problems in the past. I couple times, copies of the module got placed into the path of the Master AXS file. It drove me up a wall not knowing why the changes I was making to the modules wasn't having any effect.
Thank you for posting this, because at least I now have some understanding of how things are handled.
Jeff
I can't tell you when I started noticing this; I would think it had to be introduced with October's update of NS.
That's interesting. I tend to keep all files in the client's project folder. I also have several sub-folders in the project folder I label myself. (Includes, IR_Files, Modules, Manuals, Documents, etc...) I track what you'd call boilerplate stuff by its version number. I quite often have several versions of something depending upon what's at their system.
The reason for doing this is that I want no question about where any given file for a project is located. So, If a tech is running out with a project, all the files are in that folder, no questions. Granted I have multiple copies of the same file all over the place. but, what the heck... Hard drives are cheap.
In our case we tend to have more than one person working on stuff at a time. I store all our projects on a server and we run it 'production-style' In other words, the working projects are always stored on the server and I don't allow anyone to copy to their desktop and work locally. Our network is fast enough that it is never an issue. Our server is backed up each day and I also make a 2nd backup to an outside server. The only occasion that anyone would really need to copy it to a laptop is when they might be going somewhere where the internet is not running yet (new install) Otherwise, we try to use remote login and run from machines here.
It has saved our keisters more than once.
The workspace hasn't been changed - nor the file storage, but often any minor change to a module is ignored and the old module is reused... Regardless of which way the rev module is compiled. This nearly drove me bonkers yesterday - again...
Is anyone else having these issues?