Trouble Compiling MDL to V8i

I am attempting to compile an MDL application in V8i that worked in v8. There are commands that read as follows;

/     *+ | | | name SYM_N_PIPE SETS NEW PIPE SYMBOLOGY | | | +----------------------------------------------------------------------*

/ Private void SYM_N_PIPE

(

 void

 )

cmdNumber CMD_SYM_N_PIPE

 {

int i;

for (i=0 ; i<4 ; i++)

{

PipeSym[i] = N_PipeSym[i];

 FitSym[i] = N_FitSym[i];

           }

 }

 At the line that reads "cmdNumber CMD_SYM_N_PIPE" I get a compile error that reads as follows;

 "error: expected argument declaration" the next compile error reads "CMD_SYM_N_PIPE is not a parameter" after that I get a complile error at each place that reads as follows; "for (i=0 ; i<4 ; i++)"

the compiler is giving me an error that states "error: bad declatation" Can anyone shed some light on this?

Parents
  • Visconphoto:
    
    I am attempting to compile an MDL application in V8i that worked in v8. There are commands that read as follows; 
    Private void SYM_N_PIPE  (void)
    cmdNumber CMD_SYM_N_PIPE 
    { 
        ...
    } 
    
    

    As you probably know, the above function definition is not valid C (or C++). The line cmdNumber CMD_SYM_N_PIPE is recognised only by  Bentley MDL compilers. Because we should be building applications these days using C++, Bentley have [correction] provided a C/C++ standard way of avoiding that non-standard syntax.

    These days you should declare an array of command numbers and the functions associated with them, then register the array with MicroStation. Like this:

    
    /////////////////////////////////////////////////////////////////////////////
    //	Application command table
    MdlCommandNumber  	commandNumbers [] =
    {
    {	cmd_locateText,			CMD_LOCATE_TEXT		},
    {	cmd_locateExit,			CMD_LOCATE_EXIT		},
    // This table must be NULL-terminated
    0
    };
    // Register command table in main()
    status = mdlSystem_registerCommandNumbers (commandNumbers);
    
    

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

  • Jon Summers:
    As you probably know, the above function definition is not valid C (or C++). The line cmdNumber CMD_SYM_N_PIPE is recognised only by early Bentley MDL compilers. Because we should be building applications these days using C++, Bentley have removed the possibility of using that non-standard syntax.

    However, I am still declaring cmdNumber old fashioned syntax and creating my applications using the V8i's standard compiling tools shipped with SDK. I haven't had any problem so far.

    Perhaps you are referring to the compilation using Visual Studio, because Microsoft compiler of course is not obligated to recognize this particular syntax. I suspect that rather, Bentley had to find a way to go around the problem.

    I hope Bentley keeps its own tools recognizing the old fashion syntax, that way, portability would remain unaffected and will give us the choice of Visual Studio Vs Microstation native tools.

    Regards, Marcos

  • Marcos:
    I am still declaring cmdNumber old fashioned syntax and creating my applications using the V8i's standard compiling tools shipped with SDK.

    The Bentley V8i tools continue to understand the old syntax. You can continue to use, for pure MDL projects, the programming idiom that is familiar and comfortable.

    Marcos:
    Perhaps you are referring to the compilation using Visual Studio, because Microsoft compiler of course is not obligated to recognize this particular syntax. I suspect that rather, Bentley had to find a way to go around the problem.

    Whether it's a problem or not is moot. The syntax is non-standard, but with hindsight never needed to be non-standard. The Bentley compiler, on encountering the old syntax, would silently build a list of data structures, each comprising a command ID and a function pointer. That's how MicroStation knows which of your functions to call when the command parser decodes your command keyin.

    Arrays of IDs and function pointers are neither unusual in C/C++ nor unknown in MDL. For example, your dialog item hook functions are stored in a table of DialogHookInfo structs comprising hook IDs and hook function pointers:

    
    Private DialogHookInfo uHooks[] =
    {
    {HOOKITEMID_1,  hookItem_functionPointer1		},
    {HOOKITEMID_2,  hookItem_functionPointer2		},
    };
    
    

    You register that list of DialogHookInfo with MicroStation's Dialog Manager using mdlDialog_hookPublish().

    The above idiom is standard C/C++.

    MicroStation V8 introduced a similar idiom for command IDs and command function pointers. Command IDs (command numbers) are stored with a pointer to your command function in an array of MdlCommandNumber structs. As with DialogHookInfo this is standard C/C++ and is therefore understood by both the pure MDL compiler and any other C/C++ compiler. However, you must now inform MicroStation about your MdlCommandNumber array by registering it with mdlSystem_registerCommandNumbers (commandNumbers).

    Continue to use the old style cmdNumber syntax for existing projects, but prefer to use the C/C++ MdlCommandNumber array for new projects. That way, you can eliminate one more mental hurdle in the route to building projects as native code.

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

  • Jon Summers:
    MicroStation V8 introduced a similar idiom for command IDs and command function pointers. Command IDs (command numbers) are stored with a pointer to your command function in an array of MdlCommandNumber structs. As with DialogHookInfo this is standard C/C++ and is therefore understood by both the pure MDL compiler and any other C/C++ compiler. However, you must now inform MicroStation about your MdlCommandNumber array by registering it with mdlSystem_registerCommandNumbers (commandNumbers).

    Thanks Jon, I am already using the callbacks for dialog items, I will also try this standard command syntax with the native tools shipped with Microstation. It is good to know about different alternatives, and anyway, using the standard syntax will help with the migration process (although I will keep using the original Microstation tools for years to come, apart of visual studio)

    Best regards, Marcos

  • C++ does not require you to use Visual Studio

    Marcos:

    I will keep using the original MicroStation tools for years to come, apart of Visual Studio ...

    For many reasons it's worthwhile moving to C++ for MicroStation application development. Using a C++ compiler does not require you to use Visual Studio. However, you can't obtain Microsoft's C++ development tools without buying Visual Studio.

    Bentley's make environment is designed to build large projects. Bentley have added rules to mdl.mki that enable it to build both C++ projects as well as pure MDL projects.

    Extend your knowledge of the Bentley make file format to include C++ projects. This will enable you to take advantage of object-oriented techniques and use the MicroStationAPI.

    There are a few examples of MDL C++ projects delivered with the MicroStation SDK. We've written an example that shows how to build a C++ project using the MicroStationAPI.

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

Reply
  • C++ does not require you to use Visual Studio

    Marcos:

    I will keep using the original MicroStation tools for years to come, apart of Visual Studio ...

    For many reasons it's worthwhile moving to C++ for MicroStation application development. Using a C++ compiler does not require you to use Visual Studio. However, you can't obtain Microsoft's C++ development tools without buying Visual Studio.

    Bentley's make environment is designed to build large projects. Bentley have added rules to mdl.mki that enable it to build both C++ projects as well as pure MDL projects.

    Extend your knowledge of the Bentley make file format to include C++ projects. This will enable you to take advantage of object-oriented techniques and use the MicroStationAPI.

    There are a few examples of MDL C++ projects delivered with the MicroStation SDK. We've written an example that shows how to build a C++ project using the MicroStationAPI.

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

Children