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

MSFLIB and DFLIB

thomasglallen
Beginner
13,633 Views

I have some legacy code that uses MSFLIB and DFLIB, which apparently came from COMPAQ fortran.  When I get to the llinking, I get "error LNK2019: unresolved external symbol _f_setmessageqq referenced in the a routine".  I know that I'm using, in the routine, SETMESSAGEQQ(...), and that is the problem.  It either comes from MSLIB or DFLIB, don't know.  I get no error with the statements USE MSLIB and USE DFLIB in the fortran code, so does someone have a listing of intel  statements that are equivalent to the legacy statements in MSLIB and DFLIB.  I've searched and can't find any reference to the routines found in these libraries. Thanks.

Tom

0 Kudos
51 Replies
Steven_L_Intel1
Employee
2,504 Views

A zero sized allocation is allowed.

When your program exits, all allocated memory is automatically deallocated by the OS. Also if you declare local allocatable variables in a subroutine or function, and don't give them the SAVE attribute, they are automatically deallocated when the procedure exits.

I can't really tell from your last post what is happening. The actual allocate/deallocate step is pretty fast, but maybe you are using more memory than in the other version and starting to swap if RAM is insufficient. If you are using allocatable (and not pointer) arrays, memory leaks are, theoretically, impossible, but one never knows.

I suggest running the program under a performance profiler such as Intel VTune Amplifier XE (free 30 day trial available) and see where the program is spending the most time.

0 Kudos
thomasglallen
Beginner
2,504 Views

You're correct on the swaping of memory.  This code will eventually run on machines with 512 gigbyte memory, so I think it's OK.  Getting back to the  Dimension E(*) statement above - I replaced Dimension E(*) with what I said above - it compiled OK, ran it and entered the input file, and it gave me a program exception - access violation where the code was replaced with the allocation statements.  It runs fine with just Dimension E(*), but when changed to the allocation option, it crashes.  Do I need to add something else here to the allocation statements to make it equivalent to Dimension E(*).  Thanks.

0 Kudos
thomasglallen
Beginner
2,504 Views

One other question related to the IDE.  The program is compiled under the DOS prompt, and looks like this:

ifort /traceback /fpe:0 test.f CMB.FOR ZLOAD.FOR NETDEF.FOR NETWRK.FOR SORCES.FOR INSCOM.FOR SEGJ.FOR.SMAT.FOR DATA.FOR CRNT.FOR JNQCOM.FOR SCRATM.FOR IRESRV.FOR /exe:test.exe /map:test.map

The *.FOR are the module files that use to be COMMON files.  There is also an include file called NEC.inc. 

Now when I start a project in the IDE, I choose the command prompt and I get header files, resources files, and source files.  I added the files to the sources file (*.FOR, *.f, *.inc) and ran "Start Debugging" and get all sorts of errors; it compiles and links fine at the DOS prompt shown above.  The project is called WINNEC, and the property pages looks correct.  Can you give me any guidance on setting this up correctly in the IDE environment.  Just trying to save some time here.  Thanks

0 Kudos
Steven_L_Intel1
Employee
2,504 Views

I am not sure what you mean by "choose the command prompt".

You want to create a new project of type Fortran Console Application, with "Empty Project". Add all the source files to the project. Right click on the project, select Properties. Go to Fortran > Floating Point. Change Configuration to "All configurations". Set Floating-Point exception handling to the option that includes /fpe0, then click OK. Select Build > Build Solution. It should compile and link. Then set a breakpoint at a convenient place in the program (such as the first executable line) and start debugging by pressing F5. Note that when the program exits, the console window will go away.

0 Kudos
thomasglallen
Beginner
2,504 Views

Sorry for saying command prompt; I meant to say the project file column instead.  I had to choose no under Fortran->Diagnostics->Generate Interface Blocks in order to get the Fortran program to compile cleanly as in my command line statement shown above.  It runs and gives the same answers as when it was compiled under DOS.  The "Generate Interface Blocks" when set to yes gives a few warnings and errors that might be of concern, so I plan to look at that later and I might ask more questions about that.  At the moment, everything appears to run fine.

Right now, I've developed a C# interface for the fortran program, and runs the fortran executable from the C# GUI.  I need something more versatile than the Intel GUI that is provided (I plan to use threading and plot routines under C#). This is just a test GUI for the moment.  Is there a way to interface C# with the source code in fortran in any way?  The program outputs various information to a text file, and it would be more efficient if I can access this information via my C# GUI directly from the Fortran program rather than access the information when the fortran  outputs the finished file to disk.  If you have any ideas or direct references that would be even better. 

0 Kudos
Steven_L_Intel1
Employee
2,504 Views

There are two general options. One is to write the Fortran code as a DLL that is called "unmanaged" from C#, passed arguments and the results received back. The other is to write the Fortran code as a "COM Server" and use COM to communicate between the C# and Fortran code. The latter is a complex subject with no C# examples and is not something I would recommend starting out with, though I know of people who have used it successfully.

0 Kudos
thomasglallen
Beginner
2,504 Views

One other question.  I have the following include file that is used for array sizes (with the module replacement suggested earlier in this forum, I can now use as large of an array as memory allows):

Parameter (MAXSEG=2000, MAXMAT=7500)

There are additional similar parameter statements.  If I want to say, change the MAXSEG to 20000, I have top recompile the main program and link in the modules.  I want to avoid this and have the user input the values of this array only, and run the executable without recompiling every time the values in the parameter are changed.  What's the best way to do this under Fortran?  As a note, I'm using the ALLOCATE statement in the main Fortran program to allocate the array size, e.g., ALLOCATE(ZARRAY(MAXSEG), LDTYPE(MAXMAT),...) - there are many more of these allocate statements.  Thanks.

0 Kudos
Steven_L_Intel1
Employee
2,504 Views

Just make MAXSEG and MAXMAT integer variables and prompt the user for them. The ALLOCATE statements can stay the same.

0 Kudos
CHARAF-EDDINE_A_
Beginner
2,504 Views

Hello everybody,

I am converting a program from CVF 6.6 to IVF 11.1 and I am looking for an equivalent to this part of the code below :

1. What library should I call instead of MSFLIB ? Should I modify the functions used in the program FULLPATHQQ, ... ?

2. This program is used to open a data file named "inputData.txt", if this file does not exist in the correct directory, the line 15 (err=9001) call a window which allow to search fo a file manually (the same "open with" window that we have generally in all programs).

3. How can I change lines 15,16 ?

Thank you

  1.     USE msflib
  2.     CHARACTER($MAXPATH) pathin
  3.     CHARACTER($MAXPATH) filein
  4.     CHARACTER(2) drive
  5.     CHARACTER($MAXPATH) dir,workdir
  6.     CHARACTER($MAXPATH) namein
  7.     CHARACTER(4) ext
  8.     INTEGER*4 leng1,leng2,leng3
  9.     LOGICAl(4) result
  10.     ienter=1  
  11.     OPEN (ienter,FILE='inputData.txt',status='old',err=9001)
  12.     call Function
  13.     goto 1
  14.         
  15. 9001    open(ienter,file='',status='old',err=9000)
  16.     INQUIRE(ienter,name=filein)
  17.     leng1=FULLPATHQQ(filein,pathin)
  18.     IF(leng1.EQ.0)STOP
  19.     IF(leng1.GT.0)THEN
  20.         leng2=SPLITPATHQQ(pathin,drive,dir,namein,ext)
  21.         IF(leng2.EQ.0)THEN
  22.               WRITE(*,*) 'Can''t split path'
  23.             STOP
  24.         ENDIF
  25.     ELSE
  26.         WRITE(*,*)'Can''t get full path'
  27.         STOP
  28.     ENDIF
  29.     
  30.     RETURN
  31. 9000    WRITE(*,*) 'Reading error'
0 Kudos
Steven_L_Intel1
Employee
2,504 Views
0 Kudos
Reply