It sounds as if you did redeclaration by include, like:
File Preparx.for
==========================
INCLUDE "Serverstuff.for"
SUBROUTINE Preparx()
...
END
INCLUDE statement basically works as a copy/paste macro, and in effect you define Subroutine ServerStuff in every of your sources. I don't think that C/Fortran has anything to do with that error.
I don't know how it compiled with another compiler, but that's not the way to do things in Fortran. Actually, that's not how to do things in C either -- C include files should contain just function prototypes, not their bodies.
If my analysis is correct, you should get rid of those INCLUDE lines. Have in mind, though, that I haven't seen your actual code and that I might easily have misdiagnosed the situation.
Hi Thanks for your reply.. Part of your investigation is correct.. But serverstuff is a COMMON data which is included in "server.for" file. Check the below code from server.for file.
INTEGER clientIndex !index into client list
CHARACTER*136 Buffer(17) !buffer for pipe i/o
CHARACTER dBuffer(2313) !buffer for pipe i/o
EQUIVALENCE(dBuffer,Buffer)
COMMON/serverstuff/clientIndex,dBuffer DATA dBuffer(2313)/0/
As you said, server.for is included in some of the other files, though it is a global variable, serverstuff is giving redecleration problem when linking libraries. How can i split that COMMON data in such a way that, it should include in all required files and should not give redecleration error??
clientindex and dBuffer are using in C language piping calls(PipeRead and PipeWrite) which are called from fortran.
Thanks in advance..