public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Americo Barbosa da Cunha Junior <americo.cunhajr@gmail.com>
To: fortran@gcc.gnu.org, gcc-help@gcc.gnu.org
Subject: 16 bits char string from C to FORTRAN
Date: Fri, 24 Apr 2009 04:07:00 -0000	[thread overview]
Message-ID: <b7e3a9c0904232107r12e40077t3d4c8bd8f428d03c@mail.gmail.com> (raw)
In-Reply-To: <b7e3a9c0904231558g25f215la8802b76bb0e0e41@mail.gmail.com>

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

       reply	other threads:[~2009-04-24  4:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <b7e3a9c0904231550x28217ab0v4a6abd0b02132696@mail.gmail.com>
     [not found] ` <b7e3a9c0904231558g25f215la8802b76bb0e0e41@mail.gmail.com>
2009-04-24  4:07   ` Americo Barbosa da Cunha Junior [this message]
2009-04-24  5:14     ` Steve Kargl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b7e3a9c0904232107r12e40077t3d4c8bd8f428d03c@mail.gmail.com \
    --to=americo.cunhajr@gmail.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).