FAQ: How to use preprocessors in script for VDSP++5.0?

Document created by Kader.M Employee on Oct 18, 2017
Version 1Show Document
  • View in full screen mode



I am new to embedded programming. I see there is a way to set pre-processors using the project option, but I have an issue. I have two different builds that use alot of the same code but have slight differences. I am using pre-processors to separate out the code? If I use the project files option, that means I would need to create two projects for every project that uses the pre-processors right? To make things easier I rather have the preprocessor set at the build script to make the separations. How can I do this for VDSP? I am using c code.





You can use VisualDSP++ Automation API "AddSwitch" which adds a switch to the project-wide tool command line when building the project for the specified configuration.


The AddSwitch method is used to set a switch in the given tool’s property page.


Here is an example in VB:


Dim str


Set app = CreateObject( "VisualDSP.ADspApplication" ) Set project_list = app.ProjectList


If ( project_list.Count = 0 ) Then
    app.PrintText tabConsole, "No project loaded"
    Rem get the first project object
    Set project = project_list( 0 )
    Set tool_list = project.ToolList
    Set tool = tool_list("Compiler")  
    str = tool.AddSwitch("Debug", "-D", "MY_MACRO") End If


To use this script, you must have VBScript set as your current scripting language in the console window of the IDDE. The script can then be loaded via the File->Load Script... menu item or by opening it in an editor window and selecting Load Script from the editor context menu.


Please refer in VisualDSP++ help for more details:
Contents > Automation  > API Reference > ADspTool > Methods > AddSwitch


This document was generated from the following discussion: How to use preprocessors in script for VDSP++5.0?