Software Archive
Read-only legacy content

COM Wizard

Intel_C_Intel
Employee
494 Views
I don't suppose there is the possibility of a future version of the COM Wizard giving you the choice of output in free or fixed format is there?
0 Kudos
9 Replies
Intel_C_Intel
Employee
494 Views
Or can someone tell me if you can make a project compile proper;y with a mixture of free and fixed format files?
0 Kudos
Steven_L_Intel1
Employee
494 Views
There's no problem mixing fixed and free form in a project, as long as the free-form files have .f90 file types and the fixed-form have .f or .for. Then the compiler selects the form automatically.

Steve
0 Kudos
Intel_C_Intel
Employee
494 Views
Are you sure Steve? (I'm sure you are ;o)
I just ported some fixed format files into a COM Server project and when I tried to compile, I got errors from the auto-generated F90 files that related to fixed format (e.g. invalid characters in continuation line, not recognising '&' continuations). I had to reformat them all to be properly fixed format compliant before I could get a server compiled...
0 Kudos
Jugoslav_Dujic
Valued Contributor II
494 Views
You may have problems with INCLUDE files, but not with "normal" source files. AFAIK INCLUDEd file is assumed to have the same format as "includer". However, you may insert !DEC$FREEFORM or !DEC$NOFREEFORM as first line in include files
to let compiler handle them properly.
0 Kudos
Steven_L_Intel1
Employee
494 Views
Jugoslav is correct.

Steve
0 Kudos
Intel_C_Intel
Employee
494 Views
It maybe my options, but I'm still having to put
!DEC$ FREEFORM
at the begininning of every auto-generated file (i.e. the compiler is not distinguishing automatically between *.for and *.f90)
0 Kudos
Intel_C_Intel
Employee
494 Views
Can I modify the files in:

Microsoft Visual StudioDF98TEMPLATESCOMSERVER

to format the COM server wizard output the way I like it?
0 Kudos
Steven_L_Intel1
Employee
494 Views
If you are INCLUDEing the files, then the compiler doesn't care what the form is - it assumes the form of the file being compiled. I thought one uses modules with the COM Server wizard - it's not a topic I'm all that familiar with.

Steve
0 Kudos
Intel_C_Intel
Employee
494 Views
Hi Dan,

> It maybe my options, but I'm still having to put !DEC$ FREEFORM at the begininning of every auto-generated file (i.e. the compiler is not distinguishing automatically between *.for and *.f90)

Take a look at your project settings, Fortran tab, Fortran Language category, Source Form field. "Use File Extension" is the default and behaves as Steve said. If you have it set to something else, set it back to the default. If you need to make a setting for a single source file, select that file in the Workspace view and then select Project -> Settings...

> Can I modify the files in:
Microsoft Visual StudioDF98TEMPLATESCOMSERVER

to format the COM server wizard output the way I like it?

Yes, at your own risk... ;-) Here is a description from the latest documentation:

Discussion of Wizard Code Generation

The Wizard generates the code for your project from the files in the subdirectory of your project named project-nametemplates. The project-name.hie file contains the definition of your COM server in an undocumented text language. You should not manually edit the project-name.hie file ? the Wizard does this for you.

Most of the other files in the project-nametemplates directory are templates of the source files generated for your project. These templates contain source code that is copied "as-is" to the generated sources, and embedded directives that guide the Wizard in generating the code specific to the COM server that you define. The directives use the information in the project-name.hie file. The directives are undocumented and subject to change.

When you create a new Fortran COM Server project, the AppWizard creates the project-nametemplates directory and copies the templates from the Visual Fortran COM Server Wizard templates directory, ...Df98TemplatesCOMServer.

The files in the COM Server Wizard templates directory may change with each release of Visual Fortran, but the templates in your project-nametemplates directory are never automatically updated. For example, if you create a COM server using Visual Fortran Version 6.5 and the next release of Visual Fortran (such as Version 6.5A) contains updated templates, the templates for your COM server are not automatically updated to the new 6.5A templates. If you modify the definition of your server, your project continues to use the 6.5 templates that it was created with. This has the advantage of not introducing different code into a project that you have developed and tested.

However, there are two cases where you may want to modify the templates that are used by your project:

A new release of Visual Fortran may contain additional features that can be used in your COM server project. Some of the new features may depend upon the new templates. These features will not be available to a pre-existing project unless you update the templates in the project-nametemplates directory. You do this by copying all of the files in the Visual Fortran COM Server Wizard templates directory ...Df98TemplatesCOMServer into the project-nametemplates directory, replacing all files with the same name. Your project will then use the new templates the next time that the definition of your server is modified and the project sources are regenerated.
When you want to modify the code generated by the Wizard. You may edit a template in your project-nametemplates directory. Editing code that is copied "as-i s" is straight forward. Attempting to modify the embedded directives is unsupported and could cause the Wizard to fail when using the modified template. The embedded directives begin with an @ (at-sign) character. The next character determines the type of directive. The end of many directives is also delimited by an @ character followed by the matching end character for the type of directive. For example, @[ and @] are the delimiters for one type of directive.
The advantage of modifying a template is that you can customize the code generated by the Wizard. The disadvantages of modifying a template are:

You must be very careful not to modify a template in a manner that causes the Wizard to generate bad code or fail.
You will not be able to update the project templates with the templates from a new release of Visual Fortran without having to re-apply your modifications to the new templates.
0 Kudos
Reply