Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29275 Discussions

Help connecting COM Library in Fortran Code

HoDz
Beginner
479 Views

Hi,

I need some help to connect a COM library to my Fortran code. To start of I am using Visual Studios 2010 with Visual Fortran Compiler XE15.0 Update 3. I do have some experiance with Fortran programming but no experience with using COM libraries and their integration in various codes.

The goal is to use the Fortran code to set up and performe measurements on a commercial measurement instrument. I have access an COM library in the form of a .tlb file that can be used to controll the measurment instrument.

I have used the Intel Visual Fortran Module Wizard to create an fortran file "COMLibrary.f90" which contain modules that simplify calling of COM features in my code. The file containing the modules is then added to the Source Files in my Fortran project in VS2010.

However when I try to compile my main program the following error message is returned:

" error#6405: The same named entity from different modules and/or program unites cannot be referenced [GUID]"

for the COMLibrary.f90 file.

I do not know what the issue is and how to proceed, so I would appreciate if someone could help me understand how to set up a COM library for Fortran programming or give me a hint where such information can be found.

 

 

0 Kudos
1 Reply
Steven_L_Intel1
Employee
479 Views

The particular error you describe is because there is a type GUID defined in both IFWINTY and IFCOM, and these are different. The usual solution is to "rename away" the one you don't want, for example:

USE IFWINTY, notused=>GUID

(You may use KERNEL32 or any of the other API modules that implicitly uses IFWINTY.)

Or, you can use an ONLY clause to bring in only the names you want from a given module.

0 Kudos
Reply