>>>>>>>>
I have a user who is porting an application from Solaris to Suse linux.  He
is having a problem in compiling some of his code and has a question:

> In Solaris, I have 5 different source modules that all contain the same
> data area. I can separately compile each of the source modules to objects
> and then link them all together with no complaints.
>
> When I try the same thing on Linux, ld screams bloody murder. Apparently,
> Linux ld isn't bright enough to either combine all the data areas into a
> single one or treat each one as a separate data area for that program
> only. The data area is coded in a system header file that is included in
> each of the programs (unistd.h seems to be the ornery one).
>
> Is there a linker option that controls this type of behavior on Linux?
<<<<<<<<

      Actually, this sounds like the "standard problem" when dealing
      with portation issues;  The problem is probably in Solaris rather
      than Linux.

      In terms of portation techniques, you may want to encapsulate the
      "global" data area definitions/declarations in a shared .h (include)
      file and use a (-Dtagname) in the make file to turn on/off the
      "extern" prefix in front of various data structures, to wit:

#if   !defined(MAINLINE)
extern
#endif
         int       a,b,c,d,e,f;

      ...and the like.  This pays off quickly since it avoids any
possibility
      of common data areas becoming...   ...uncommon (where it's "private"
to
      a particular module).  I've seen some pretty funky stuff in the past
      when I used to deal with porting Thoroughbred Business BASIC to a
wide
      range of Unix/Xenix platforms...

--------------------
John R. Campbell, Speaker to Machines (GNUrd)      {813-356|697}-5322
"Will Work for CLAIM Codes"
IBM Certified: IBM AIX 4.3 System Administration, System Support

Reply via email to