16 bits char string from C to FORTRAN

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello there,

I'm  calling a FORTRAN subroutine in a ANSI C program. The subroutine
has the following prototype:

C:

void CKINIT_(int *LENICK,int *LENRCK,int *LENCCK,int *LINC,int *LOUT,
                    int *ICKWRK,double *RCKWRK,char *CCKWRK,int *IFLAG);

FORTRAN:

      SUBROUTINE CKINIT (LENIWK, LENRWK, LENCWK, LINC, LOUT, ICKWRK,
     1                   RCKWRK, CCKWRK, IFLAG)
C
C  START PROLOGUE
C
C  SUBROUTINE CKINIT (LENIWK, LENRWK, LENCWK, LINC, LOUT, ICKWRK,
C                     RCKWRK, CCKWRK, IFLAG)*
C     Reads the binary file and creates the internal work arrays
C     ICKWRK, CCKWRK, and RCKWORK.  CKINIT must be called before any
C     other CHEMKIN subroutine is called.  The work arrays must then
C     be made available as input to the other CHEMKIN subroutines.
C
C  INPUT
C     LENIWK - Length of the integer work array, ICKWRK.
C                   Data type - integer scalar
C     LENCWK - Length of the character work array, CCKWRK.
C              The minimum length of CCKWRK(*) is MM + KK.
C                   Data type - integer scalar
C     LENRWK - Length of the real work array, WORK.
C                   Data type - integer scalar
C     LINC  -  Logical file number for the binary file.
C                   Data type - integer scalar
C     LOUT  -  Output file for printed diagnostics.
C                   Data type - integer scalar
C
C  OUTPUT
C     ICKWRK - Array of integer workspace.
C                   Data type - integer array
C                   Dimension ICKWRK(*) at least LENIWK.
C     RCKWRK - Array of real work space.
C                   Data type - real array
C                   Dimension RCKWRK(*) at least LENRWK.
C     CCKWRK - Array of character work space.
C                   Data type - CHARACTER*16 array
C                   Dimension CCKWRK(*) at least LENCWK.
C     IFLAG  - IFLAG=0 indicates successful reading of
C              binary linking file; IFLAG>0 indicates
C              error type.
C                   Data type - integer
C  END PROLOGUE


The char* string passed to CKINIT must be at least 16 bits
(CHARACTER*16) or the program is finished with the error message:

          CHARACTER LENGTH OF CCKWRK MUST BE AT LEAST 16


I've tried to change the length of the char type in C redefining
CHAR_BIT constant:

#include <limits.h>
#define CHAR_BIT 16


The program compiles without errors but every time that it is executed
the error message above is returned.

I'll become extremely grateful if someone can help me.


Thank you in advance.

Americo Cunha Jr
http://web.me.com/americo


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux