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..
If server.for is only to be used as an include file maybe you could try renaming it to server.inc (or something similar - some people prefer server.fi for example). Change all of your "include server.for" to "include server.inc"
{ I don't see how from the code you have shown, but it sounds like server.for is being compiled as a function/subroutine in its own right, every time - hence the multiple declarations }
A better option would be to make server.for a MODULE (instead of common) which you then USE in those routines that need that data.
module serverstuff
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)
...
end module serverstuff
Les
Les