public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* fortran+c
@ 1999-12-06  8:14 Alfonso Alba Garcia
  1999-12-06  8:14 ` fortran+c. I forgot one thing: Alfonso Alba Garcia
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Alfonso Alba Garcia @ 1999-12-06  8:14 UTC (permalink / raw)
  To: help-gcc

Hello everybody,

I would like to get information about how to compile fortran subroutines
in C programs an vice versa. I have managed to do it with small programs
in both directions. My problem is with common blocks, I don't know how
to access them from a C function.

For example, if I have a fortran MAIN program:

PROGRAM TRY
	common/block/A,B
	.
	.
	.
END

How can I have access to A and B from a C subroutine to manipulate them?

Thanks in advance.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: fortran+c. I forgot one thing:
  1999-12-06  8:14 fortran+c Alfonso Alba Garcia
@ 1999-12-06  8:14 ` Alfonso Alba Garcia
  1999-12-31 22:24   ` Alfonso Alba Garcia
  1999-12-06 22:44 ` fortran+c Tim Prince
  1999-12-31 22:24 ` fortran+c Alfonso Alba Garcia
  2 siblings, 1 reply; 8+ messages in thread
From: Alfonso Alba Garcia @ 1999-12-06  8:14 UTC (permalink / raw)
  To: help-gcc

Sorry, I fogot to say that I'm using gcc and g77 in RH6.0. just in case
it is important. Thanks again.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: fortran+c
  1999-12-06  8:14 fortran+c Alfonso Alba Garcia
  1999-12-06  8:14 ` fortran+c. I forgot one thing: Alfonso Alba Garcia
@ 1999-12-06 22:44 ` Tim Prince
  1999-12-06 23:14   ` fortran+c Tim Prince
  1999-12-31 22:24   ` fortran+c Tim Prince
  1999-12-31 22:24 ` fortran+c Alfonso Alba Garcia
  2 siblings, 2 replies; 8+ messages in thread
From: Tim Prince @ 1999-12-06 22:44 UTC (permalink / raw)
  To: help-gcc

>	common/block/A,B
>

As g77 falls squarely within the f2c style of fortran implementation, in case
of question you could use f2c to translate into gcc.  I would expect

extern struct{float A;float B;}block;
Tim Prince
tprince@computer.org

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: fortran+c
  1999-12-06 22:44 ` fortran+c Tim Prince
@ 1999-12-06 23:14   ` Tim Prince
  1999-12-31 22:24     ` fortran+c Tim Prince
  1999-12-31 22:24   ` fortran+c Tim Prince
  1 sibling, 1 reply; 8+ messages in thread
From: Tim Prince @ 1999-12-06 23:14 UTC (permalink / raw)
  To: help-gcc

or, using the default f2c-compatible underscore-appending, lower-casing, and
typedefing (f2c.h probably #includes g2c.h and may not be found in the standard
include directories on your system) :

#include "f2c.h"

struct {
    real a, b;
} block_;
Tim Prince
tprince@computer.org

^ permalink raw reply	[flat|nested] 8+ messages in thread

* fortran+c
  1999-12-06  8:14 fortran+c Alfonso Alba Garcia
  1999-12-06  8:14 ` fortran+c. I forgot one thing: Alfonso Alba Garcia
  1999-12-06 22:44 ` fortran+c Tim Prince
@ 1999-12-31 22:24 ` Alfonso Alba Garcia
  2 siblings, 0 replies; 8+ messages in thread
From: Alfonso Alba Garcia @ 1999-12-31 22:24 UTC (permalink / raw)
  To: help-gcc

Hello everybody,

I would like to get information about how to compile fortran subroutines
in C programs an vice versa. I have managed to do it with small programs
in both directions. My problem is with common blocks, I don't know how
to access them from a C function.

For example, if I have a fortran MAIN program:

PROGRAM TRY
	common/block/A,B
	.
	.
	.
END

How can I have access to A and B from a C subroutine to manipulate them?

Thanks in advance.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: fortran+c
  1999-12-06 23:14   ` fortran+c Tim Prince
@ 1999-12-31 22:24     ` Tim Prince
  0 siblings, 0 replies; 8+ messages in thread
From: Tim Prince @ 1999-12-31 22:24 UTC (permalink / raw)
  To: help-gcc

or, using the default f2c-compatible underscore-appending, lower-casing, and
typedefing (f2c.h probably #includes g2c.h and may not be found in the standard
include directories on your system) :

#include "f2c.h"

struct {
    real a, b;
} block_;
Tim Prince
tprince@computer.org

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: fortran+c
  1999-12-06 22:44 ` fortran+c Tim Prince
  1999-12-06 23:14   ` fortran+c Tim Prince
@ 1999-12-31 22:24   ` Tim Prince
  1 sibling, 0 replies; 8+ messages in thread
From: Tim Prince @ 1999-12-31 22:24 UTC (permalink / raw)
  To: help-gcc

>	common/block/A,B
>

As g77 falls squarely within the f2c style of fortran implementation, in case
of question you could use f2c to translate into gcc.  I would expect

extern struct{float A;float B;}block;
Tim Prince
tprince@computer.org

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: fortran+c. I forgot one thing:
  1999-12-06  8:14 ` fortran+c. I forgot one thing: Alfonso Alba Garcia
@ 1999-12-31 22:24   ` Alfonso Alba Garcia
  0 siblings, 0 replies; 8+ messages in thread
From: Alfonso Alba Garcia @ 1999-12-31 22:24 UTC (permalink / raw)
  To: help-gcc

Sorry, I fogot to say that I'm using gcc and g77 in RH6.0. just in case
it is important. Thanks again.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~1999-12-31 22:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-12-06  8:14 fortran+c Alfonso Alba Garcia
1999-12-06  8:14 ` fortran+c. I forgot one thing: Alfonso Alba Garcia
1999-12-31 22:24   ` Alfonso Alba Garcia
1999-12-06 22:44 ` fortran+c Tim Prince
1999-12-06 23:14   ` fortran+c Tim Prince
1999-12-31 22:24     ` fortran+c Tim Prince
1999-12-31 22:24   ` fortran+c Tim Prince
1999-12-31 22:24 ` fortran+c Alfonso Alba Garcia

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).