New Language Extensions in Sun Studio 12 C Compiler

Sun Studio software engineer Dmitry Mikhailichenko gives an overview of some of the C-language extensions introduced in Sun Studio 12. Although some of these extensions are not part of the latest C99 standard, they are supported by the gcc compiler.
The article also demonstrates how to use the new C features for creating generic macros with an example of linked-list manipulation-routines. Such macros semantically mimic C++ Standard Template Library, support arbitrary data types and provide strict compile-time type-checking.
Read the entire article at http://developers.sun.com/solaris/articles/c_type.html and leave your comments in this forum entry. We'd like to know what you think about these extensions and if you have additional suggestions for the Sun Studio compiler team.

Thank you for reporting the problem! I've submitted CR 6642662. It should be visible on web in a day or so.
Boris

Similar Messages

  • Is it possible to run sun studio 12 ide with sun studio 8 compiler?

    Hi, i am in the process of evaluating sun studio 12. Our company cannot move to sun studio 12 compiler collection right now as it is a huge code base and it will take us few months even before we start using sun studio 12 compiler in our development environment. Is it possible to use sun studio 12 ide with sun studio 8 compiler collection(CC, dbx etc)? Your feedback is appreciated. thank you.

    There are two parts to the answer.
    1) whether you can
    To choose a compiler set follow Tools->Options->C/C++
    and in the BuildTools tab you'll see how it picks up
    compilers from your PATH.
    This dialog doesn't govern choice of dbx, which will always
    come from the installation. However you can alter which dbx
    is used by presetting the environment variable SPRO_DBX_PATH
    to teh full pathname of a dbx of your choice.
    2) whether you should
    The IDE should work reasonably well with older compilers. They
    are not that tightly bound.
    The IDE will not work well enough with an older dbx, especially as
    old as studio 8. However, while not officially supported or tested
    the SS12 dbx should be reasonably bwd compatible with code
    generated from older compilers.
    So my recommendation is: don't use SPRO_DBX_PATH and
    give the old compilers a try.

  • Recommendation for new features in next Sun Studio releases

    Hello,
    I have started using the Sun Studio Express recently and as a feedback to your opening to receive proposals to new features in the next releases of the Sun Studio collection I would want to point some aspects of interest to the programmers in writing good software for embedded systems and not only.
    First of all, with regards to the subject of great interest to me in this moment, multicore/multiprocessor parallel programming, I would appreciate the following :
    - if the compiler would be extended with new directives to allow the programmer to measure the load of each core and/or processor that is available to him.
    - if the compiler would be extended with directives to allow the programmer to get the core ID on which a specific section of code is executed. As en example consider o multithreaded application and in the associated function for each thread read the core ID and function of this value perform specific actions.
    - if the compiler would be extended with directives to allow the programmer to get the ID of the processor in the system - supposing a specific system has many multicore processors. (I don't know if this is possible).
    - if the compiler would be extended with directives to allow the programmer to specify the core and/or processor on which it wants to be executed a specific process,thread,function,(maybe instruction).
    With these macros I think a lot of things can be exercised, one that I think in this moment is the posibility for the programmer to implement his own algorithm of load balancing for the cores and processors of his system.
    Another point I would recommend would be that the watch window in the Sun Studio IDE to permit the selection of the format in which the data to be displayed.As an example if I have a U32 variable to be able to select in the watch window the integer ,hexadecimal or binary format in which I would want to be displayed.
    Another useful thins that I sought at other IDEs would be a popup window or something similar to select how to see the source code: as a .c file , as an assembler code , or as a mixture of C and assemble.
    That's all for the moment, if I see something else I would post another message.
    Thank you,
    Steve.

    steveg wrote:
    First of all, with regards to the subject of great interest to me in this moment, multicore/multiprocessor parallel programming, I would appreciate the following :
    - if the compiler would be extended with new directives to allow the programmer to measure the load of each core and/or processor that is available to him.
    - if the compiler would be extended with directives to allow the programmer to get the core ID on which a specific section of code is executed. As en example consider o multithreaded application and in the associated function for each thread read the core ID and function of this value perform specific actions.
    - if the compiler would be extended with directives to allow the programmer to get the ID of the processor in the system - supposing a specific system has many multicore processors. (I don't know if this is possible).
    - if the compiler would be extended with directives to allow the programmer to specify the core and/or processor on which it wants to be executed a specific process,thread,function,(maybe instruction).
    With these macros I think a lot of things can be exercised, one that I think in this moment is the posibility for the programmer to implement his own algorithm of load balancing for the cores and processors of his system.
    These are OS functions, not compiler's. Solaris has a wide selection of ways and tools to assign processes and threads to cpus; processor_bind(2) is a function you can call and pbind(1M) is a tool you can use on a running app. There are more, just google for it.
    Another point I would recommend would be that the watch window in the Sun Studio IDE to permit the selection of the format in which the data to be displayed.As an example if I have a U32 variable to be able to select in the watch window the integer ,hexadecimal or binary format in which I would want to be displayed.
    Good point. I'll check if there already is an RFE (Request For Enhancement) filed and file one if it's not. Thanks for letting us know!
    Another useful thins that I sought at other IDEs would be a popup window or something similar to select how to see the source code: as a .c file , as an assembler code , or as a mixture of C and assemble.
    But there is disassembly window already. See screenshot here: http://developers.sun.ru/images/stories/sunstudio/images/sun_studio_dbx.png

  • How to generate gdb compatible .o for CMT using Sun Studio C compiler?

    Hello,
    we've been working on a joint project for telco bearer plane applications on CMT.
    We started the project using gcc for Sparc and we switched to Sun Studio compiler when we hit some bugs in gcc (optimized mode was not completely stable). The switch took a few weeks due to syntax differences and toolchain option changes.
    With Sun Studio we got a double digit percent performance improvement, so Sun Studio proved more stable and faster than gcc.
    To debug programs we require gdb, because the Telco customers are more familiar with it. The problem is that Sun Studio generates object files which are not compatible with gdb.
    Our main requirement is to be able to generate gdb compatible object files using Sun Studio compiler.
    We checked this link:
    http://cooltools.sunsource.net/gcc/ReleaseNotes.html
    but this seems to be a variant of gcc. At this point we cannot switch compiler because of the performance and stability issues mentioned above and because it will take a few weeks to months to switch.
    We have two questions:
    1) Is there a way to generate gdb compatible object files using Sun Studio 11?
    2) If not, is this funcionality going to be available in a future release of Sun Studio and what is the time frame?
    Thanks for your help.
    Marco Zandonadi
    Teja Technologies

    The undefined symbol is in the C++ runtime support library that is part of Solaris. Probably you have an out-fo-date version of the libraries.
    You can get current patches from the Sun Studio patch page:
    http://developers.sun.com/prodtech/cc/downloads/patches/index.html
    From the page for your version of WorkShop or Sun Studio, select the C++ Runtime Library patch for the version of Solaris that your are running. While you are at it, you can get the current compiler patches as well.
    If patching the runtime libraries does not fix the problem, let me know, and also show the exact command lines that you use for compiling and linking the program.

  • Sun studio C++ compilation error in std when compile ACE5.2

    CC -mt -g -instances=explicit -g -I/home/xxx/ACE_wrappers -DACE_NO_INLINE -c -KPIC -o .shobj/Basic_Types.o Basic_Types.cpp
    "/opt/SUNWspro/prod/include/CC/Cstd/./stdexcept", line 57: Error: Function std::logic_error::~logic_error() can throw only the exceptions thrown by the function std::exception::~exception() it overrides.
    "/opt/SUNWspro/prod/include/CC/Cstd/./stdexcept", line 60: Error: Function std::logic_error::what() const can throw only the exceptions thrown by the function std::exception::what() const it overrides.
    "/opt/SUNWspro/prod/include/CC/Cstd/./stdexcept", line 128: Error: Function std::runtime_error::~runtime_error() can throw only the exceptions thrown by the function std::exception::~exception() it overrides.
    "/opt/SUNWspro/prod/include/CC/Cstd/./stdexcept", line 131: Error: Function std::runtime_error::what() const can throw only the exceptions thrown by the function std::exception::what() const it overrides.
    "/opt/SUNWspro/prod/include/CC/Cstd/./istream", line 41: Error: Use ";" to terminate declarations.
    "/opt/SUNWspro/prod/include/CC/Cstd/./ostream", line 438: Error: Illegal number of arguments for std::ostream::operator<<(std::basic_ostream<std::basic_ostream<std::charT, std::traits>::charT, std::basic_ostream<std::charT, std::traits>::traits>&, std::ostream::charT).
    "/opt/SUNWspro/prod/include/CC/Cstd/./iostream", line 43: Where: While specializing "std::ostream ".
    "/opt/SUNWspro/prod/include/CC/Cstd/./iostream", line 43: Where: Specialized in non-template code.
    "/opt/SUNWspro/prod/include/CC/Cstd/./ostream", line 444: Error: Illegal number of arguments for std::ostream::operator<<(std::basic_ostream<std::basic_ostream<std::charT, std::traits>::charT, type "std::ostream ".
    "/opt/SUNWspro/prod/include/CC/Cstd/./iostream", line 43: Where: While specializing "std::ostream ".
    "/opt/SUNWspro/prod/include/CC/Cstd/./iostream", line 43: Where: Specialized in non-template code.
    "/opt/SUNWspro/prod/include/CC/Cstd/./ostream", line 438: Error: Illegal number of arguments for std::wostream::operator<<(std::basic_ostream<std::basic_ostream<std::charT, std::traits>::charT, std::basic_ostream<std::charT, std::traits>::traits>&, std::wostream::charT).
    "/opt/SUNWspro/prod/include/CC/Cstd/./iostream", line 46: Where: While specializing "std::wostream ".
    "/opt/SUNWspro/prod/include/CC/Cstd/./iostream", line 46: Where: Specialized in non-template code.
    "/opt/SUNWspro/prod/include/CC/Cstd/./ostream", line 444: Error: Illegal number of arguments for std::wostream::operator<<(std::basic_ostream<std::basic_ostream<std::charT, std::traits>::charT, std::basic_ostream<std::charT, std::traits>::traits>&, char).
    "/opt/SUNWspro/prod/include/CC/Cstd/./iostream", line 46: Where: While specializing "std::wostream ".
    "/opt/SUNWspro/prod/include/CC/Cstd/./iostream", line 46: Where: Specialized in non-template code.
    "/opt/SUNWspro/prod/include/CC/Cstd/./ostream", line 451: Error: Illegal number of arguments for std::wostream::operator<<(std::ostream &, char).
    "/opt/SUNWspro/prod/include/CC/Cstd/./iostream", line 46: Where: While specializing "std::wostream ".
    "/opt/SUNWspro/prod/include/CC/Cstd/./iostream", line 46: Where: Specialized in non-template code.
    Compilation aborted, too many Error messages.
    make: *** [.shobj/Basic_Types.o] Error 1
    sun0% CC -V
    CC: Sun C++ 5.9 SunOS_sparc Patch 124863-01 2007/07/25

    I have solved the problem by adding "-D ACE_HAS_EXCEPTIONS"

  • Sun Studio 11 Warning raised after new compiler upgrade

    Hi All,
    I have an issue regarding the warning raised by new complier upgrade.
    Sun Studio 11 is the product and OS is Solaris 8.The following are the warning messages after successful compilation
    1. Warning: declarator required in declaration
    2. Warning: Last line in file "../inc/bibbnote.h" is not terminated with a newline
    Please advise me on the above issue wheather the above warnings can be ignored.
    Regards
    Vinoth
    Message was edited by:
    vinothsankar

    Those lines are not valid C++, since no typedef name is provided. Sun C++ accepts them as an extension, but issues a warning because the code is not valid.
    Examples:
    typedef int Int;
    Int is declared to be a synonym for int.
    typedef int;
    Invalid: no name is provided as a synonym for int.
    enum Foo { a, b, c};
    Foo is declared to be an enumerated type with enumerators a, b, c.
    Typedef Foo Bar;
    Bar is declared to be a synonym for Foo
    typedef enum { d, e, f } E1;
    E1 is a synonym for the unnamed enumerated type with enumerators d, e, and f. This is a C style declaration, which serves no useful purpose in C++.
    typedef enum E2 { g, h, i } E3;
    E2 is declared to be an enumerated type with enumerators g, h, i, and a synonym E3.
    typedef enum E4 { j, k, l };
    Invalid declaration. No name is provided as a synonym for E4. Remove the "typedef" and you have a valid declaration of E4 as an enumerated t ype.
    References: C++ Standard, sections
    7.1.3 The typedef specifier
    7.2 Enumeration declarations

  • Problem in compilation using Sun Studio 11

    Hello,
    We are migrating from a Solaris 8 to a Solaris 10 OS. At the same ttime we are also migrating from Ingres 2.6 to Ingres 2006. As a part of the creation of teh development environment, we are recompiling all the codes on teh new OS. WE have installed teh Sun Studio 11 compiler for this purpose. When compiling some C codes, we are getting the following error:
    "am_xxxxxxxx.c", line 2596: warning: statement not reached
    "am_xxxxxxxx.c", line 2778: undefined symbol: i8
    "am_xxxxxxxx.c", line 2778: syntax error before or at: )
    "am_xxxxxxxx.c", line 2858: undefined symbol: i8
    "am_xxxxxxxx.c", line 2858: syntax error before or at: )
    "am_xxxxxxxx.c", line 2889: warning: implicit function declaration: IIresnext
    "am_xxxxxxxx.c", line 2891: warning: statement not reached
    "am_xxxxxxxx.c", line 2920: warning: statement not reached
    "am_xxxxxxxx.c", line 2931: undefined label: IIfdF1
    "am_xxxxxxxx.c", line 2931: undefined label: IIosl9139
    "am_xxxxxxxx.c", line 2931: undefined label: IIfdE1
    "am_xxxxxxxx.c", line 2931: cannot recover from previous errors
    cc: acomp failed for am_xxxxxxxx.c
    The command used for compiling is :
    cc -xarch=generic64 am_xxxxxxxx.c
    We have exported teh following:
    LD_LIBRARY_PATH_64=/usr/sfw/lib/sparcv9:/usr/local/lib/sparcv9:/usr/lib/sparcv9:/usr/openwin/lib/sparcv9:/usr/dt/lib/sparcv9:/opt/SUNWspro/lib/v9:/opt/SUNWspro/lib/v9:/eu/ingad/ingres/lib:/opt/oracle/lib:/usr/lib:/usr/ucblib:/usr/openwin/lib:/opt/SUNWspro/lib/:/opt/lib/cobol/coblib
    LD_LIBRARY_PATH=/opt/SUNWspro/lib/v9:/eu/ingad/ingres/lib:/eu/ingad/ingres/lib:/opt/oracle/lib:/usr/lib:/usr/ucblib:/usr/openwin/lib:/opt/SUNWspro/lib/:/opt/lib/cobol/coblib
    CXXFLAGS=-fast -xarch=v9b
    CFLAGS=-fast -xarch=v9b
    LDFLAGS=-L/usr/sfw/lib/sparcv9 -L/usr/lib/sparcv9 -R/usr/sfw/lib/sparcv9 -R/usr/lib/sparcv9
    We are struggling with this issue for the last one week. Can someone please help me with this issue?
    Could this be because the 64 bit library files are not installed? Please help.
    Aneesha

    The LD_LIBRARY_PATH environment variables determine where the runtime loader looks for shared libraries when you run an application. It is unlikely to be the source of compile-time errors.
    I suspect that doing two major changes at the same time has resulted in undefined names and other problems, probably due to missing or incorrect header inclusion. If possible, make one change at a time, either compile the old code on the new OS, or the new code on the old OS, and get that to work first.
    Check the Ingress documentation to see if you need to make source code changes when upgrading, and follow any recommendations there. You might also need to take up this problem with Ingress tech support.
    Regarding LD_LIBRARY_PATH, the best advice is usually "don't set it at all". For more on this topic, see this article:
    http://blogs.sun.com/rie/entry/tt_ld_library_path_tt
    Just to eliminate this as a possible build problem, try removing LD_LIBRARY_PATH and LD_LIBRARY_PATH_64 from your environment when building the program. Then modify the build process to set the executable runpath (-R option) to include the Ingress or Oracle libraries that need to be searched. You don't normally want to point into /usr/lib or into the compiler installation area.

  • Exceptions not caught in shared library when compiled under Sun Studio 9

    I realize it's a fairly old version of Sun Studio, however if at all possibly we'd like to avoid updating to the latest.
    Sun Studio 9, version reports
    version of "/opt/SUNWspro/bin/../prod/bin/../../bin/cc": Sun C 5.6 2004/07/15
    version of "/opt/SUNWspro/bin/../prod/bin/../../bin/CC": Sun C++ 5.6 2004/07/15
    uname -a
    SunOS sunblade 5.9 Generic_118558-27 sun4u sparc SUNW,Sun-Blade-100
    The problem is within our shared library a function calls another method within a try/catch block. This method then sometimes throws an exception which does have a matching catch block. On all other systems (Windows, AIX, HP-UX, Linux) the code works, the exception is caught and handled. On Solaris with Sun Studio 9 though, the exception is ignored and instead triggers an abort and core dump.
    Stack Trace:
    ffffffff7daa871c lwpkill (6, 0, ffffffff7fffd9c0, ffffffff7d3064d4, 2, ffffffff7fffd9ec) + 8
    ffffffff7da3e4b8 abort (ffffffff7d40dac8, ffffffff7d40cc38, ffffffff7d411e78, 10604c, 2, ffffffff7d40dac8) + 100
    ffffffff7d3064d4 __1cH__CimplRdefault_terminate6F_v_ (ffffffff7d40dac8, ffffffff7d40cc38, ffffffff7d411e78, 10604c, 104e40, ffffffff7d3064d0) + 4
    ffffffff7d3062b4 __1cH__CimplMex_terminate6F_v_ (ffffffff7d40de40, 0, 0, ffffffff7d40de40, ffffffff7d40c978, 1) + 24
    ffffffff7d306f04 exthrow_body (ffffffff7d40de40, 0, 0, 105af4, 52, ffffffff7d40e2e8) + 84
    ffffffff7d306e58 __1cG__CrunIex_throw6Fpvpkn0AQstatic_type_info_pF1_v_v_ (ffffffff7d40dec8, ffffffff7f0dea78, ffffffff7ecb6b28, ffffffff7d40de40, 0, ffffffff7d40de40) + 3c
    ffffffff7ecb6d90 __1cLIGExceptionFThrow6FnQenumIGErrorCodes_pkcxxp2x_v_ (fffffffffffff3e3, 0, 0, 0, ffffffff7f1187da, a0) + 80
    ffffffff7ecb6e78 __1cOThrowException6FnQenumIGErrorCodes_pkcxxp1x_v_ (fffffffffffff3e3, 0, 0, 0, ffffffff7f1187da, a0) + 30
    ffffffff7f083304 __1cSIGRasterProcessingNVerifyPalette6FpnMIGRasterPage_nTenumIGContrastModes__v_ (1001f3c10, 0, 0, 0, 0, 0) + b4
    ffffffff7f083760 __1cSIGRasterProcessingOInvertContrast6FpnMIGRasterPage_nTenumIGContrastModes_nTenumIGColorChannels_pnPtagAT_RECTANGLE__v_ (1001f3c10, 0, 0, ffffffff7fffe1a8, 0, 0) + 20
    ffffffff7f039a2c iIG_IP_contrast_invert (1001f3c10, 100162b10, 0, 0, 0, 0) + 104
    ffffffff7f039ba0 iIG_IP_contrast_invert_masked (1001f3c10, 100162b10, 0, 0, 0, 0) + 80
    000000010000b4e0 ipcontrast_invert_notify (10014d000, 10014d, 0, 100000, 100162000, 100162) + 48
    Try/catch block:
         try
              <Triggering function>
         catch(const IGException& ige)
              <Handling Code>
    The code which throws the exception is a static method of IGException which has a basic throw line:
         throw IGException(...);
    Source code is compiled with the following flags, none of which I could find any info to suggest affect this:
    CC -c -Xt -xCC -misalign -xarch=v9 -O
    Linking of the shared object is then done via the following, again nothing obvious that could cause issues. mapfile is an empty file.
    ld -o <outputfilename> -G -z textoff -M mapfile -z noversion -64 -h <outputfilename> <object files> -L/opt/SUNWspro/lib/v9 -lCrun -lX11 -lc -lm
    I did read somewhere mentioning to make sure to use RTLD_GLOBAL if using dlopen on the .so, but the test app is using ld to link the library.
    Does anyone have any ideas why with the Sun Studio 9 compiler these exceptions are not being caught? Based on the fact they are caught on all other compilers, i'm guessing this issue is with the compiler.
    Also, as a test it seems that if the shared object is not built as a 64-bit object, then everything works. The issue only seems to occur when it is a 64-bit object. Likely an issue with the 64-bit compiling?
    Edited by: 837682 on Feb 17, 2011 9:23 AM

    As the other poster pointed out, you need to link the shared library using CC, not ld. I should have noticed that error in the original post.
    Try using CC instead of ld in your link command. The CC command causes additional files to be linked into the shared library that are required for proper operation, and particularly for exception handling. I think that is the actual source of your problem.
    You should not use -L options that point into the compiler installation area, and when you use CC to link, you don't need to.
    I'm surprised that you seem to have a copy of libCrun.so.1 in the compiler installation area -- that should not be the case. The the only versions of libCrun should be static libraries libCrun.a. You almost never want to link with a static version of a system library, and absolutely never when building a shared library. The file /opt/SUNWspro/lib/libCrun.so.1 ought to be a symbolic link pointing to /usr/lib/libCrun.so.1, but if that were the case, the version command would have the same output.
    By any chance, did you install your compiler by copying it from another installation? If you do that, you need to use tar, not cp, to ensure that symbolic links are preserved.

  • Sun Studio code hangs at fork, GCC code runs fine

    I am encountering a strange problem where code complied with GCC runs fine, but the same code compiled with Sun Studio 12 compiler hangs at a fork call after an initial set of fork calls.
    I'd appreciate your help in solving this.
    The code was originally written for GCC, I started using the Sun Studio with a view to using Sun's thread analyzer. I made a couple of changes which I think are inoccuous:
    (a) added #ifdef __SUNPRO_CC char * __FUNCTION__ = "name"; #endif
    (b) one more #ifdef around one call to ctime_r because the g++ include expects 2 parameters while Sun Studio 12 expects 3 parameters.
    The g++ is compiled on a Solaris 9 (1 x sparcv9) using GCC 3.3.3
    while the Sun Studio 12 is on a Solaris 10 ( 4 x sparcv9).
    Both runs were on the same Solaris 10 machine which has the compiler.
    The program is a multi instance socket listener, the main program binds to a socket, then forks off a set of processes which accept connections, those children later fork off other client applications based on the connection data; after those clients exit, the children continue accepting etc. The main program only monitors the child processes, records their status and starts if any of those die.
    This is working as expected when compiled with g++.
    The exact same code (note the two sets of #ifdefs above) when compiled with Sun PRO CC alway hangs at the second set of fork. That is, it goes through the first set of forks fine, then when a connection is established, it reads the data but hangs right at the fork call.
    The application code at this point is:
    char * p = pathfind( getenv("PATH"), progname );
    if ( !p ) {  printError(); return false; }
    pid = fork();
    The truss for the Sun Studio code shows
    23914: access("/usr/bin/progname", X_OK) = Err#2 ENOENT
    23914: access("/usr/you/bin/progname", X_OK) = 0
    23914: lwp_park(0x0000000, 0) (sleeping)
    while the truss for the g++ code shows
    23986: access("/usr/bin/progname", X_OK) = Err#2 ENOENT
    23986: access("/usr/you/bin/progname", X_OK) = 0
    23996: fork1() = 24005
    What am I doing wrong?
    Thanks and best regards

    If I understand correctly, you are compiling with gcc on Solaris 9, and with Sun Studio on Solaris 10. Since the OS is different, you might be running into OS issues and not compiler issues. What happens if you build with the same gcc version on the Solaris 10 system where you see the problem?
    By "OS issues", I mean
    1. The program uses unstable or undocumented OS interfaces, or
    2. A bug that is new in Solaris 10.
    A bug was identified in Solaris 10 that could cause forks to hang. It showed up in the libpkcs11 library as used by the JVM. I don't know whether it showed up elsewhere.
    This bug was fixed in Solaris 10u2. If you are using an earlier version of Solaris 10, you could try upgrading.

  • Binary compatibility problems using Sun Studio 12

    I'm working in a project that uses Orbix [1] third-party libraries. I have installed the Sun Studio 12 on Solaris 10 SPARC but I have got some strange segfault problems (the exactly same code works fine in a Linux box - using g++). I read the 1.4 section of Sun Studio 12 C++ Userguide [2] but I have a doubt:
    Is there no way to compile my code using Sun Studio 12 using shared libraries compiled against earlier Sun Studio C++ compiler versions (like Sun Studio 8 or some version before Sun Studio 11)?
    I think my problem is related to the fact that Orbix team used Sun Studio 8 as some notes found in their headers indicate:
    "IONA Technologies ART IDL Compiler POA C++ Generator asp 6.3.3 SunOS 5.8 CC_5.5 2008/06/13 21:04:37 EDT"
    A secondary question: Is CC 5.5 present in Sun Studio 8, right?
    Can anyone help me? Every tips are welcome :) Thanks in advance!
    [1] http://web.progress.com/en/orbix/orbix_standard.html
    [2] http://docs.sun.com/app/docs/doc/820-7599/6nirkt6f7?a=view

    AmadeuBarbosa wrote:
    I'm working in a project that uses Orbix [1] third-party libraries. I have installed the Sun Studio 12 on Solaris 10 SPARC but I have got some strange segfault problems (the exactly same code works fine in a Linux box - using g++). I read the 1.4 section of Sun Studio 12 C++ Userguide [2] but I have a doubt:I don't think 1.4 Binary Compatibility Verification applies in your case. It's referring to processor capability to execute certain (new) instructions; if your third-party libraries were compiled a while ago, it's highly unlikely they use instructions not implemented by the processor you have.
    Is there no way to compile my code using Sun Studio 12 using shared libraries compiled against earlier Sun Studio C++ compiler versions (like Sun Studio 8 or some version before Sun Studio 11)?Generally speaking, any library compiled with older Sun Studio C++ compiler is supposed to be compatible with any library or executable compiled with newer version provided that all parties did everything right. For example, that third-party libraries should not be statically linked with C++ run-time support libraries; your executable should be linked with latest compiler driver (CC) so that it records correct dependencies on support libraries.
    Of course, there could be (and actually are) compiler bugs standing in the way of compatibility. Some of them can be fixed, some - like demangler issue described in http://docs.sun.com/source/820-4155/c++.html - can't. There is no easy way to tell if you hit a compiler bug or bulding/linking issue, or bug in the code that was previously unseen.
    I think my problem is related to the fact that Orbix team used Sun Studio 8 as some notes found in their headers indicate:
    "IONA Technologies ART IDL Compiler POA C++ Generator asp 6.3.3 SunOS 5.8 CC_5.5 2008/06/13 21:04:37 EDT"Yes, looks like it was compiled by 5.5, which is part of Sun Studio 8
    >
    A secondary question: Is CC 5.5 present in Sun Studio 8, right?That's correct.

  • Using devguide in Sun Studio 11?

    Hi!
    Newbie question here: Can I use OpenWindows DevGuide as my GUI builder for my application in the Sun Studio 11 compiler?
    Any help would be appreciated! Thanks!

    My work really is to migrate a GIS application from the Sun Workshop 4.2 Compiler to Sun Studio 11. Since the GUI builder of the application in the old compiler is DevGuide, it also entails changing it to X-Designer.
    I already used the "gil2xd" utility but the GUI in DevGuide is better than that of X-Designer. Another problem is porting from Xview(used in DevGuide) to MOTIF Library(used in X-Designer). There is no one-to-one correspondence between the functions and attributes of the two libraries.
    This is really the remaining and hardest part of the migration process. I was thinking if Xview is compatible with X-Designer so that I could just retain the codes but still get the same results.
    Thank you for all the help, guys!
    Rix

  • Sun Studio 12 IDE and dbx

    I got fresh installation of the Sun Studio 12 on Solaris 10, and I am trying to debug in the IDE. Project is using Sun Studio's compiler. But in the options I can see only gdb debugger. I looked into installed plugins, and there is no plugin for dbx (there is for gdb). Am I missing something? dbx binary is installed.

    could you, please provide more details.
    What system, how you installed SS12, etc.Solaris 10 11/06 s10x_u3wos_10 X86
    I looked into installed plugins, and there is no plugin for dbx (there is for gdb).Where you are looking it for? Can you see module here:
    Tools | Module Manager | Debugging ?
    "dbx Debugger UI" Module should be there and should be enabled.
    "C/C++ GDB Debugger" should be disabled.Yes, I had been looking there. There is no dbx plugin in that list.
    In the installation log, dbx gui is referenced as installed without any problems:
    Sun Studio 12 dbx GUI plug-in(i386) 12.0,REV=2007.05.10
    Installing Sun Studio 12 dbx GUI plug-in as <SPROdbxui.2>
    /opt/sunstudio12/SUNWspro/inventory/v16n1/SPROdbxui
    /opt/sunstudio12/SUNWspro/prod/config/Modules/com-sun-tools-debugger-dbxgui.xml
    /opt/sunstudio12/SUNWspro/prod/modules/com-sun-tools-debugger-dbxgui.jar
    Installation of <SPROdbxui.2> was successful.
    Installed Package: SPROdbxui.2
    So I run find . -type f | ggrep 'modules.*\(dbx\|gdb\)'
    ./SUNWspro/prod/modules/com-sun-tools-debugger-dbxgui.jar
    ./SUNWspro/prod/modules-xml/off/org-netbeans-modules-cnd-debugger-gdb.xml
    ./SUNWspro/prod/modules-xml/on/org-netbeans-modules-cnd-debugger-gdb.xml
    ./netbeans-5.5.1/cnd1/update_tracking/org-netbeans-modules-cnd-debugger-gdb.xml
    ./netbeans-5.5.1/cnd1/modules/locale/org-netbeans-modules-cnd-debugger-gdb_ja.jar
    ./netbeans-5.5.1/cnd1/modules/locale/org-netbeans-modules-cnd-debugger-gdb_zh_CN.jar
    ./netbeans-5.5.1/cnd1/modules/org-netbeans-modules-cnd-debugger-gdb.jar
    ./netbeans-5.5.1/cnd1/config/Modules/org-netbeans-modules-cnd-debugger-gdb.xml
    That plugin seems to be installed in the different directory. Is it possible to enable it somehow?

  • Sun Studio 11 "Warning (Anachronism)"

    Hello,
    Compiling a C++ program using Sun Studio 11 compiler on Solaris, I get warnings like this:
    Warning (Anachronism): Using blabla(*)(<params>) to initialize extern "C" blabla(*)(<params>).
    For example, this happens passing a callback of type jvmtiHeapObjectCallback to IterateOverHeap (both defined in Sun's jvmti.h):
    typedef jvmtiIterationControl (JNICALL *jvmtiHeapObjectCallback)
    (jlong class_tag, jlong size, jlong* tag_ptr, void* user_data);
    jvmtiError (JNICALL IterateOverHeap) (jvmtiEnv env,
    jvmtiHeapObjectFilter object_filter,
    jvmtiHeapObjectCallback heap_object_callback,
    const void* user_data);
    What does this warning mean?
    I checked that JNICALL is defined in Solaris jni_md.h as empty string, so it seems strange for me that the compiler wants extern "C" here.
    The same code compiles with no problems on Solaris with gcc, as well as with Visual Studio on Windows and with gcc on Linux and Mac.
    Best regards,
    Anton

    Thank you for your prompt reply.
    In the guide, it is said:
    "The Sun implementation of C and C++ function linkage is binary-compatible. That is not the case with every C++ implementation, although it is reasonably common".
    I believe that for all other platforms that we support - Linux, Mac OS X, Windows - the only difference in C and C++ linkage is C++ name mangling.
    I'm not 100% sure (just curious, do you know any implementations where C and C++ functions are not linkage compatible?), but there never were runtime problems with such C/C++ function mixing in our code.
    Actually, the mixing happens in our code because we declare class with single static function (callback implemetation) right in the function where function requiring callback parameter is used. This is similar to Java anonymous classes, and helps to write simpler code (especially when callback code is short, and there are many different callbacks in different places of the code):
    void qqq() {
    struct Tmp {
    static void myCallback() { ... }
    foo(&Tmp::myCallback);
    So, unfortunately, the offered solutions (wrapping) will not work in our case, unless we simply rewrite our callbacks as regular C functions.
    Is there a compiler option (or a pragma) to suppress this warning?

  • Problem while using GDB to debug a binary generated with Sun's CC compiler

    When I compile any .cpp file with CC compiler using -g option:
    CC -g test.cpp
    and use GDB to debug, it works fine. However if I compile in two steps as in:
    CC -g test.cpp -o test.o
    CC -g test.o
    GDB complains and says "Debug Symbol not found"
    THis is definately not correct, however not sure if its a GDB Bug or SunCompiler Bug. I've checked on both forums however could not fin any such bug reported? Is it that I am missing on something ?
    Regards,
    Sumit

    Just in case it is not a misprint: first command for compilation in two steps is weird -- it's missing -c (compile) parameter. If it's not there, test.o would be executable, not object. From the other hand, linker seem to treat that as an error producing no output, so I consider lack of -c as an artifact of forum post.
    Now, to gdb complaints... I just tried to compile a tiny program using CC 5.9 (from Sun Studio 12) and debug it with gdb 6.4 (from Nexenta repository) and 6.6 (built from source). First one (6.4) didn't recognize a.out as an executable, second one (6.6) read a.out fine and I was able to debug it.
    So the point is it's all about versions. I don't know much about [recent] changes in gdb, but Sun Studio C++ compiler has only recently switch it's default debugging information format to DWARF, which gdb should understand. Previous version (5.8 from Sun Studio 11) produced stabs by default and this format was known to be incompatible with what GCC produces for GDB.
    If you have Sun Studio 11 (or earlier) you can try switching to dwarf by adding -xdebugformat=dwarf to C++ compiler command line. But if at all possible, I'd recommend you to upgrade to Sun Studio 12 (and probably latest gdb) and start from there.
    Also, dbx should be able to debug executables produced by Sun Studio compilers in any way and the transition from gdb to dbx might be easier, especially if you're on Solaris where all power of dbx unveils. Check out this table, it should help you to start using dbx:
    http://blogs.sun.com/dbx/entry/gdb_vs_dbx_commands_mapping
    And remember there's 'gdb on' command, which makes dbx accept some gdb native commands.

  • Strange C++ error when using newer Sun Studio compiler

    My company has just set up a new build machine for our product. We have gone from
    this version: CC: Sun C++ 5.7 Patch 117830-11 2007/04/04
    to this one: CC: Sun C++ 5.9 SunOS_sparc Patch 124863-01 2007/07/25
    we have also upgraded the OS (solaris/sparc). I think the new one has gcc but the old one doesn't (we don't use it).
    and now I am getting this error:
    "/opt/SUNWspro/prod/include/CC/./new", line 32: Error, badextlnk: operator new(unsigned) was declared before with a different language.
    "/opt/SUNWspro/prod/include/CC/./new", line 35: Error, badextlnk: operator delete(void*) was declared before with a different language.
    "/opt/SUNWspro/prod/include/CC/./new", line 37: Error, badextlnk: operator new[](unsigned) was declared before with a different language.
    "/opt/SUNWspro/prod/include/CC/./new", line 40: Error, badextlnk: operator delete[](void*) was declared before with a different language.
    "/opt/SUNWspro/prod/include/CC/./new", line 53: Error, badollnk: Only one of a set of overloaded functions can be extern "C".
    "/opt/SUNWspro/prod/include/CC/./new", line 54: Error, badollnk: Only one of a set of overloaded functions can be extern "C".
    "/opt/SUNWspro/prod/include/CC/./new", line 55: Error, badollnk: Only one of a set of overloaded functions can be extern "C".
    "/opt/SUNWspro/prod/include/CC/./new", line 56: Error, badollnk: Only one of a set of overloaded functions can be extern "C".
    "/opt/SUNWspro/prod/include/CC/Cstd/rw/iterator", line 106: Error, temnotexternc: Template declarations cannot have extern "C" linkage.
    "/opt/SUNWspro/prod/include/CC/Cstd/rw/iterator", line 169: Error, temnotexternc: Template declarations cannot have extern "C" linkage.
    "/opt/SUNWspro/prod/include/CC/Cstd/rw/iterator", line 185: Error, temnotexternc: Template declarations cannot have extern "C" linkage.
    "/opt/SUNWspro/prod/include/CC/Cstd/rw/iterator", line 198: Error, temnotexternc: Template declarations cannot have extern "C" linkage.
    "/opt/SUNWspro/prod/include/CC/Cstd/rw/iterator", line 202: Error, temnotexternc: Template declarations cannot have extern "C" linkage.
    "/opt/SUNWspro/prod/include/CC/Cstd/rw/iterator", line 206: Error, temnotexternc: Template declarations cannot have extern "C" linkage.
    "/opt/SUNWspro/prod/include/CC/Cstd/rw/iterator", line 217: Error, badollnk: Only one of a set of overloaded functions can be extern "C".
    "/opt/SUNWspro/prod/include/CC/Cstd/rw/iterator", line 225: Error, temnotexternc: Template declarations cannot have extern "C" linkage.
    "/opt/SUNWspro/prod/include/CC/Cstd/rw/iterator", line 239: Error, temnotexternc: Template declarations cannot have extern "C" linkage.
    "/opt/SUNWspro/prod/include/CC/Cstd/rw/iterator", line 249: Error, temnotexternc: Template declarations cannot have extern "C" linkage.
    "/opt/SUNWspro/prod/include/CC/Cstd/rw/iterator", line 264: Error, temnotexternc: Template declarations cannot have extern "C" linkage.
    "/opt/SUNWspro/prod/include/CC/Cstd/rw/iterator", line 275: Error, temnotexternc: Template declarations cannot have extern "C" linkage.
    I have no idea what could be causing this. I can find one link to it on this forum: http://forums.sun.com/thread.jspa?messageID=9488983 . But the only answer to that query says it is the same as another bug which appears entirely different, not to mention being very old (while talking about an imminent fix), and being related to a different OS and (I think) a different version of sun studio (express vs. normal?).
    Any ideas? Could it be related to having gcc/g++ on the machine?

    Hi,
    I am also facing the same error while upgrading the Sun compiler description as below
    when I am compiling the cxx file on the system with compiler version (CC: Sun C++ 5.9 SunOS_sparc 2007/05/03) , I am facing the following error:-
    /opt/SUNWspro/bin/CC -dy -misalign -xcode=abs64 -xarch=v9 -D__EXTENSIONS__ -Dsun4_R5=1 -I. -Isun4_R5_v -I/home/as185259/ash_iadraid/ash_get_10/IA/PORT/include -I/home/as185259/ash_iadraid/ash_get_10/IA/WV/WV5.3.6-ncr0302/build/include/sun4_R5_v -I/app/oracle/product/10.2.0/client_1/sqllib/public -I/app/oracle/product/10.2.0/client_1/precomp/public -I/opt/informix/include -DSVR4 -O -g p -pta -c MContext.cxx -o sun4_R5_v/MContext.o || \
    (rm -f sun4_R5_v.d; false)CC: Warning: -xarch=v9 is deprecated, use -m64 to create 64-bit programs
    "/home/as185259/ash_iadraid/ash_get_10/IA/WV/WV5.3.6-ncr0302/build/include/sun4_R5_v/ssmalloc.h", line 97: Error: Only one of a set of overloaded functions can be extern "C".
    "/home/as185259/ash_iadraid/ash_get_10/IA/WV/WV5.3.6-ncr0302/build/include/sun4_R5_v/ssmalloc.h", line 99: Error: Only one of a set of overloaded functions can be extern "C".
    "/home/as185259/ash_iadraid/ash_get_10/IA/WV/WV5.3.6-ncr0302/build/include/sun4_R5_v/ssmalloc.h", line 101: Error: Only one of a set of overloaded functions can be extern "C".
    "/home/as185259/ash_iadraid/ash_get_10/IA/WV/WV5.3.6-ncr0302/build/include/sun4_R5_v/ssmalloc.h", line 102: Error: Only one of a set of overloaded functions can be extern "C".
    4 Error(s) detected.
    The same file with the same compilation command is getting compiled with compiler version CC: Sun WorkShop 6 update 2 C+ 5.3 2001/05/15 .
    Can anyone suggest what should be the resolution:-
    The code for the ssmalloc.h file is as under:-
    #ifndef SSMALLOC_H
    #define SSMALLOCH
    #include <stddef.h>
    #if defined(__sparcv9)
    namespace ssmalloc {
    #endif
    #if defined(__cplusplus)
    extern "C" {
    #endif
    The type for the malloc routine depends on
    the compiler and library that you are using.
    #if defined(hpux) || defined(sun4_R5) || defined(__GNUC_) || defined(_OS2_)
    typedef void MALLOC_PTR;
    #else
    typedef char *MALLOC_PTR;
    #endif
    #if defined(_GNUG_)
    typedef size_t MALLOC_SIZE;
    #else
    typedef unsigned MALLOC_SIZE;
    #endif
    #if defined(sun4) && ! defined(_GNUG_)
    # define FREE_RETURNS int
    # define FREE_RETURN return 0
    #else
    # define FREE_RETURNS void
    # define FREE_RETURN return
    #endif
    // User-callable routines.
    // Note: memalign and valloc are broken in that they do not aling
    // memory on documented boundaries, and thus do not behave as described
    // on the "malloc" manual page. They simply call malloc.
    MALLOC_PTR malloc (MALLOC_SIZE size);
    FREE_RETURNS free (MALLOC_PTR data);
    MALLOC_PTR realloc (MALLOC_PTR data, MALLOC_SIZE size);
    MALLOC_PTR calloc (size_t nelem, size_t elsz);
    MALLOC_PTR valloc (unsigned size);
    MALLOC_PTR memalign (unsigned alignment, unsigned size);
    // This memory allocator supports memory allocation inside signal
    // handlers. For correct operation, the following functions must be
    // called upon entering and exiting signal handlers that allocate
    // memory.
    void ssmalloc_enter_signal_level();
    void ssmalloc_exit_signal_level();
    // Set this variable to not 0 (possibly in the debugger) if you want
    // to get malloc to check memory data structures very carefully as it
    // goes. This may be handy if you are trying to detect a memory
    // trasher.
    // It also causes ssmalloc to abort the program instead of returning
    // zero if memory runs out.
    extern int check_memory_very_carefully;
    #if defined(__cplusplus)
    #endif
    #if defined(__sparcv9)
    } // namespace ssmalloc {
    #endif
    #endif / SSMALLOCH */
    The Machine is
    root@ldg1-> uname -a
    SunOS ldg1 5.10 Generic_138888-03 sun4v sparc SUNW,Sun-Blade-T6320
    Thanks
    Vijay

Maybe you are looking for

  • Having trouble setting up Open DNS with mac.

    When I try to set up Open DNS I get the following error message: Safari can't open the page "http://192.168.1.1/Basic.tri" because the server unexpectedly dropped the connection. This sometimes occurs when the server is busy. Wait for a few minutes,

  • Photoshop elements 12 won't run

    the program is installed  Windows XP - Service Pack 3  When I double click it gives a message that the program had to close  It never opens

  • IE 6 preview problem

    Hi - Happy Easter, by the way (to those that celebrate)... Anyone up for a challenge getting a page to view properly? - It looks great in IE7, but IE6  the top shadow graphic jumps offset, and the content area stretches a little to reveal a repeat in

  • Should I eject external drives when I shut down my Mac?

    Hello to all, This might be a very elementary question to some, but I trust I will be given the proper answer. I have been using my Mac for nearly a year and I have not been ejecting my external drive/s once a day's work is over. I use the drop down

  • Dynamic Text Flash Pro

    Hi, so i'm new to Flash but I am slowly learning. The thing I need to do my not be possible but if it is I would love to know how. So... I'm creating a quiz on Flash, and on my question screen, I have an avatar that I want animated but I cant have it