Compiler Compatibility

Hi Techies

I would like to get clarity regarding the support on the compatibility of the various Compiler versions.

We already have an application compiled on

clip

# cc -V

cc: Sun C 5.3 2001/05/15

clap--

Now the application has come up with the Development Kit which we can customize to fit our requirements. So ideally we will be using some API's to create new features.

We compile our Development Kit on

clip--

# cc -V

cc: Sun C 5.8 2005/10/13

clap--

Will the compiled object on 5.8 version of Sun C Compiler work with the application which is compiled on Sun C 5.3 Compiler?

Thanks and Regards

S.Karthikeyan

INDIA

[724 byte] By [KarthikSen] at [2007-11-26 8:54:32]
# 1
My understanding is that it should work. It's not supposed to work (but there's still a chance) if you link statically with system libraries (libc, etc.); this, however, is more about Solaris than C compiler.
MaximKartashev at 2007-7-6 22:50:38 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 2

The Sun compatibility story is that you can link a binary created by an older compiler or on an older version of Solaris into a program built with a newer compiler or on a newer version of Solaris.

If you create code using a new compiler, you can link the old binaries into the new code using the new compiler.

But you can't depend on linking the new binaries into programs using the old compiler.

In case that isn't clear, here's an example:

1. OK, link old binary into new program

cc53 -c foo.c

cc58 -o myprog foo.o bar.cc

2. Not OK, link new binary into old program

cc58 -c bar.c

cc53 -o myprog bar.o foo.cc

The reason for the assymetry is that new compilers and new versions of Solaris sometimes have inferfaces not available with old compilers or old versions of Solaris. But the old interfaces are preserved in new compilers and new versions of Solaris.

clamage45 at 2007-7-6 22:50:38 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 3

But could you clarify that i already have an application which is built on 5.3 Compiler version.

I now use the Dev kit to create my own applications with 5.8 version, which is more like an addon to the existing application compiled on 5.3 Compiler.

Will the code break or my addon will work as expected?

Thanks

Karthikeyan

KarthikSen at 2007-7-6 22:50:38 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 4
As Steve have said,> you can't depend on linking the new binaries into programs using the old compiler.which means: use [b]new[/b] compiler to link your [b]new[/b] addon with [b]old[/b] app. This way it should work.
MaximKartashev at 2007-7-6 22:50:38 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 5

> I now use the Dev kit to create my own applications with 5.8 version, which is more like an addon to the existing application compiled on 5.3 Compiler.

Please, explain what does [i]"addon"[/i] mean in terms of objects and libraries?

Is it just a library (5.8-compiled) that is dynamically loaded by that initial (5.3-compiled) application?

regards,

__Fedor.

SFV at 2007-7-6 22:50:38 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 6

I have an application that claims that it is shipped with 5.3 Version of compiled code.

An SDK was released through which i can add new features to the existing application. With the help of SDK i can unleash the API built with the main application and create and customize my own functionality to be part of application by compiling my code in 5.8 version.

I mean that i can create an "add-on" feature to the existing application, will my object code that is compiled with version 5.8 be compatible with the main application that is shipped with compiled code of version 5.3.

Thanks and Regards

S.Karthikeyan

INDIA

KarthikSen at 2007-7-6 22:50:38 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 7
If I understand correctly, you have binaries that were built using cc 5.3, and you want to create new code using cc 5.8.You can compile new code using cc 5.8, and use cc 5.8 to link the old and new binaries to create a new program.Does that answer your question?
clamage45 at 2007-7-6 22:50:38 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 8

You can always try it and see. The further apart the two compilers

are in release time, the more likely you are to encounter problems. You

should also pay attention to which version of Solaris was used to build

the application. Usually if the application says "we support Solaris X and

above", then the application was built on Solaris X. It will be safest if

you also compile your plugin module on Solaris X (oldest version

supported by the app) even if you don't intend to run on a Solaris

that is that old.

If you stick to fairly simple and portable C code in the extension module,

things are likely to work. We add new features to the compiler

in each release, and some of the features will fail or intefere with

your program if you mix versions in the wrong way. So we can't really

promise anything. If you get a mysterious seg fault you will have to

investigate that yourself. But if you get a specific error message when

you try mixing versions, you post the message here and see if anyone

can help you work around it.But (as others have said) Sun's official

support for mixing compilers is restricted to "forward linking" (linking

with newer version).

Is your module loaded as a shared library? Or is linked into the

application by "relinking" the main program?

--chris

ChrisQuenelle at 2007-7-6 22:50:38 > top of Java-index,Development Tools,Solaris and Linux Development Tools...
# 9

HI all

I find that almost my question is answered. To still give you all a clear picture, i do not have access to the Source code of the application. All i have is the set of APIs which are shipped with the SDK. I cannot compile/alter the application by any means.

In such a case, using SDK with the API available, i simply create an object file and copy the file to a specific location that the application demands, the application then picks it up and works perfectly.

The application seems to take the object file at runtime and it works.

Thanks

S.Karthikeyan

KarthikSen at 2007-7-6 22:50:38 > top of Java-index,Development Tools,Solaris and Linux Development Tools...