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

How to migrate "AUTODICE" sample to IVF

eduardo_adame
Beginner
422 Views

Hi,

Ive been looking on the whole forum; how to save data from a Fortran program to an Excel file.

And finally, I found a sample named AUTODICE that is in the CVF samples and I tried to export it to IVF.

But there are many errors building the solution, for example:

Linking...

Debug/Autodice.obj:warning : locally defined symbol __imp__EXCEL97A_mp_$CHART_AXES imported

Debug/Autodice.obj:warning : locally defined symbol __imp__EXCEL97A_mp_$CHART_CHARTWIZARD imported

Debug/Autodice.obj:warning : locally defined symbol __imp__EXCEL97A_mp_CHARTS_ADD imported

Debug/Autodice.obj:warning : locally defined symbol __imp__EXCEL97A_mp_WORKBOOKS_OPEN imported

Debug/Autodice.obj:warning : locally defined symbol __imp__EXCEL97A_mp_$APPLICATION_GETWORKBOOKS imported

Debug/Autodice.obj:warning : locally defined symbol __imp__EXCEL97A_mp_$APPLICATION_SETVISIBLE imported

Autodice.obj : warning LNK4217: locally defined symbol _EXCEL97A_mp_$CHART_AXES imported in function _MAIN__

Autodice.obj : warning LNK4217: locally defined symbol _EXCEL97A_mp_$CHART_CHARTWIZARD imported in function _MAIN__

Autodice.obj : warning LNK4217: locally defined symbol _EXCEL97A_mp_CHARTS_ADD imported in function _MAIN__

Autodice.obj : warning LNK4217: locally defined symbol _EXCEL97A_mp_WORKBOOKS_OPEN imported in function _MAIN__

Autodice.obj : warning LNK4217: locally defined symbol _EXCEL97A_mp_$APPLICATION_GETWORKBOOKS imported in function _MAIN__

Autodice.obj : warning LNK4217: locally defined symbol _EXCEL97A_mp_$APPLICATION_SETVISIBLE imported in function _MAIN__

Autodice.obj : error LNK2019: unresolved external symbol _SLEEPQQ@4 referenced in function _CHECK_STATUS

Debug/autodice.exe : fatal error LNK1120: 1 unresolved externals

I have read the document Porting Applications from Compaq Visual Fortran to Intel Visual Fortran Compilers and I just followed those steps.

Im a newbie in IVF and I dont know if I need to execute the Fortran Module Wizard again and replace EXCEL97A.f90.

Can somebody tell me what to do? or upload AUTODICE sample built on IVF?.

Thank you so much.

0 Kudos
4 Replies
Steven_L_Intel1
Employee
422 Views
There's actually only one error - the reference to _SLEEPQQ@4. If you find the source that's calling SLEEPQQ and add, just after the SUBROUTINE or FUNCTION, the line:

USE IFPORT

then this error should go away. The rest of the messages are warnings you can ignore.
0 Kudos
oscar_abraham
Beginner
422 Views

Thanks so much for your help, Steve.
That works so good on AUTODICE example, thanx. But now I'm using this example to create another program which save data on Excel.

It builds succesfully as you told me, but when it runs,it doesn't do many operations.

WhenI debug I get the following lines causing the problem:
Code:

  CALL $Application_SetVisible(excelapp, .TRUE.)
  workbooks = $Application_GetWorkbooks(excelapp, $STATUS = status)
  workbook = Workbooks_Open(workbooks, "C:HISTO.XLS", $STATUS = status)
  worksheet = $Workbook_GetActiveSheet(workbook, status)
  range = $Worksheet_GetRange(worksheet, vBSTR1, vBSTR2, status)
  CALL Range_Select(range, status)


If I delete these lines the program works fine, although I can't export to excel.

When building I get the following warnings:
locally defined symbol __imp__EXCEL97A_mp_RANGE_SELECT imported
locally defined symbol __imp__EXCEL97A_mp_$WORKSHEET_GETRANGE imported
locally defined symbol __imp__EXCEL97A_mp_$WORKBOOK_GETACTIVESHEET imported
locally defined symbol __imp__EXCEL97A_mp_WORKBOOKS_OPEN imported
locally defined symbol __imp__EXCEL97A_mp_$APPLICATION_GETWORKBOOKS imported
locally defined symbol __imp__EXCEL97A_mp_$APPLICATION_SETVISIBLE imported

Do you have any idea how can I fix these warnings?
I think if therewere no warnings this would work.

Thanks again so much!.

0 Kudos
Steven_L_Intel1
Employee
422 Views
The warnings can be ignored - they are not causing any problems. They're telling you that the linker has been told that a symbol is both locally defined and imported from a DLL. It ignores the import request, as it should.

If you're having a problem, it's unrelated to those warnings.
0 Kudos
oscar_abraham
Beginner
422 Views
Thank you for all your help Steve,
I have already found the problem, it was that EXCEL97A.F90 functions like:

Workbooks_Open $Application_GetWorkbooks $Workbook_GetActiveSheet

modify an array value when they execute, for example:
Code:
 USE DFLIB
USE DFWIN
USE DFCOM
USE DFCOMTY
USE DFAUTO
USE ADOBJECTS
USE EXCEL97A
...
C     THIS IS MY ARRAY       
      DIMENSION VEC(22)

...

C     OPEN A FILE      
      OPEN (UNIT = 3, FILE = 'DATA.TXT', STATUS = 'OLD')

...
C     EXPORTING EXCEL CODE	
	! Get the WORKBOOKS object
      workbooks = $Application_GetWorkbooks(excelapp, $STATUS = status)
      CALL Check_Status(status, " Unable to get WORKBOOKS object")

	! Open the specified spreadsheet file (note: specify the full file path)
      workbook = Workbooks_Open(workbooks, "C:E.XLS", $STATUS = status)
      CALL Check_Status(status, " Unable to get WORKBOOK object")

	! Get the worksheet
      vInt%VT = VT_I4
      vInt%VU%LONG_VAL = 1
      worksheet = $Workbook_GetActiveSheet(workbook, status)
      CALL Check_Status(status, " Unable to get WORKSHEET object")
...
C     READ DATA FROM THE FILE	
      READ (3,*) X
...

When the program arrives tothe line " READ (3,*) X" the values of VEC change from:
VEC(1)0.000000000000000E+000
VEC(2)0.000000000000000E+000
VEC(3)0.000000000000000E+000
VEC(4)0.000000000000000E+000
VEC(5)0.000000000000000E+000
VEC(6)0.000000000000000E+000
VEC(7)0.000000000000000E+000
VEC(8)0.000000000000000E+000
VEC(9)0.000000000000000E+000
VEC(10)0.000000000000000E+000
To:
VEC(1)2.766767616710981E-322
VEC(2)1.190981997784375E-316
VEC(3)1.698179314427550E-313
VEC(4)1.697596632821624E-313
VEC(5)9.284182976689338E-302
VEC(6)6.578186951992344E-313
VEC(7)9.281441685695655E-302
VEC(8)3.927450923397306E-307
VEC(9)2.313002578360705E-307
VEC(10)3.810214909260900E-307

When I delete the EXCEL97A.F90 functions from my Main Program this problem doesn't happen.
Do you have any idea how to resolve this error?
Thank you again, I appreciate your help.
0 Kudos
Reply