Using Fortran in Microsoft Visual C++



Fortran routines are included in C-code using the cfortran packages, and the cernlibs. The cernlibs are compiled as a dynamic lib library so your c-code has to be compiled as a dll.

Microsoft Developer Studio Settings

From the menu chose Build and the Settings menu item. The Fortran, C/C++ and Link items have to be changed as follows.

  Fortran
  category: Fortran Libraries
      Using run time library: Multithreaded DLL
            

  C/C++
  category:  Code Generation
      Using run time library: Multithreaded DLL

  Link
  category:  input
     ignore libraries:     
            libc.lib, libcmt.lib, libcd.lib, libcmtd.lib, msvcrtd.lib

Example

There are the following files:
main.c
The main.c files defines the pawc common block.
hb.c
hb.c contains the two functions which show how histograms and ntuples are booked.
cfortran.h
The standard cfortran.h include file (copied from CERN). This file should be edited at all.
hbook.h
hbbok.h contains the definition of the cernlib/hbook functions. Your own fortran subroutines definitions has to go in here.
There is a tar file that contains all four files. Good luck.
Back to Daq Page or Silicon home page

comments or questions :


Break out of frames to bookmark page thereafter.