#pragma pack(1) error

Hi,
I use forte c++ 6 in Solaris 2.6, a error occurs when i use #pragma pack(1) with a class having contruction function as following:
#pragma pack(1)
class AClass
public:
     AClass(int a);
     short ashort;
     int aint;
#pragma pack()
I get the wrong result : sizeof(AClass) =8 ;
But if i only have non-contruction functions(not including virtual functions) , i get the right result: sizeof(AClass) =6
thanks in advance.

We've had the same problem with #pragma pack(1).
When a class or a struct is not 'plain old data' (POD), it packs with 'normal' alignment instead of pack(1) apparently.
You can make the class 'POD' by:
- removing constructors
- removing private data
Other functions (as operator overloaders) are allowed, as we found out by trail/error.
Anyway, you will find out if you remove the constructor from your class (and make e.g. an operator overloader for the assignment operator) that the packing will work as expected.

Similar Messages

  • Pragma pack(1) - relocation Error

    Hi,
    I am trying to use the #pragma pack(1) with Forte C++.
    I do use the -misalign option both at compilation and link.
    However, when I use a in this context, a class with virtual functions I get compilation errors at code generation ("location counter not on word boundary"). I get rid of these by compiling in debug mode, but then when linking I got the following error :
    "ld: fatal: relocation error: R_SPARC_DISP32: file foo.o: symbol <unknown>: offset
    0xfd8ea37b is non-aligned" as many times as I have virtual functions in my class.
    Has anyone used virtual functions in classes compiled with pragma pack(1)? and faced the same problem ?
    Am I missing an option ?
    Is there a workaround ?
    Thanks in advance.

    We've had the same problem with #pragma pack(1).
    When a class or a struct is not 'plain old data' (POD), it packs with 'normal' alignment instead of pack(1) apparently.
    You can make the class 'POD' by:
    - removing constructors
    - removing private data
    Other functions (as operator overloaders) are allowed, as we found out by trail/error.
    Anyway, you will find out if you remove the constructor from your class (and make e.g. an operator overloader for the assignment operator) that the packing will work as expected.

  • #pragma pack(1) problem

    <PRE>
    Let's assume that variable with the size more than 1 byte is located in memomry
    at the address, wich is not divisible to this variable (short - 2 bytes,
    int - 4 bytes and so on).
    In this case if we are trying to work with this variable then we receive error and
    program stops it's work with message "Bus Error"
    Example
    Test.cc:
    #include <stdio.h>
    #pragma pack(1)
    struct DTest {
    char chD1;
    int nD1;
    char chD2;
    int nD2;
    #pragma pack()
    main () {
    struct DTest DT;
    printf ("sizeof (DTest) = %d \n", sizeof(struct DTest));
    printf ("ptrDT = %p \n", &DT);
    printf ("&nD1 = %p \n", &DT.nD1);
    DT.nD1 = 100;
    printf ("nD1 = %d \n", DT.nD1);
    -------------- test --------------------
    *) Create executalbe with the command:
    CC Test.cc -o Test
    *) Execute:
    ./Test
    *) Result of work:
    sizeof (DTest) = 10
    ptrDT = ffbef25a
    &nD1 = ffbef25b
    Bus Error
    &nD1 = ffbef25b ;; pointer to variable (int type) is not
    ;; aligned in memort at 4
    </PRE>

    By design, #pragma pack works only on POD structs, for two reasons. A non-POD class is likely to have an unpredictable layout, and vtable pointers should not be misaligned (it would kill performance on SPARC).
    In retrospect, restricting packing to POD structs is too severe, as in your example. CR 4494035, visible at [http://bugs.sun.com], requests the requirement to be loosened. This RFE has not yet been implemented.
    When the "packed" attribute was introduced, it allowed some non-POD structs to be packed, but not structs that have a vtable pointer.
    Edited by: clamage45 on Mar 29, 2010 8:38 AM

  • Windows vista home premium service pack 2.error measage __(the windows installer service could not be accessed.this can occur if the windows installer is not correctly installed .contact your support personnel for assistance )no error nurber

    windows vista home premium service pack 2。error measage __(the windows installer service could not be accessed.this can occur if the windows installer is not correctly installed .contact your support personnel for assistance )no error nurber

    Hi Abdallah,
    According to your description, could you please post the summary and detail logs for further analysis? By default, the logs can be found in: C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log.
    Usually, the error occurs when the Windows Installer Service is not running or the Windows Installer registry settings are corrupted.  I recommend you reset the Windows Installer Service settings in the registry and restart the Windows Installer Service,
    then reinstall SQL Server 2008 R2. For more details, please review this similar
    article.
    Thanks,
    Lydia Zhang

  • Support pack has error status

    Hi All,
    Could you please let me know  if any last updated support pack has error status can we apply spam/saint update ??
    Regards,
    Pankaj

    couldn't understand your query....
    Explain in brief about your query/issue?
    Regards,
    Nick Loy

  • #pragma pack not working

    Hi,
    I'm using the forte CC compiler (CC: Sun WorkShop 6 update 1 C++ 5.2 2000/09/11) on a SUNOS 5.6 Ultra 250).
    Iam trying to use the #pragma pack option and am not able to get desired results.
    Here is a small test case
    //===========================================================================
    // compiled with:
    // CC -misalign -g -o prg prg.cc
    // output:
    // Sizeof Class_1 = 8 (expected: 6)
    // Sizeof Class_2 = 6 (expected: 6)
    //===========================================================================
    #include <stdio.h>
    #include <stdlib.h>
    #pragma pack(2)
    class Class_1{
    public:
    int data_1;
    char data_2[2];
    Class_1(){}
    class Class_2{
    public:
    int data_1;
    char data_2[2];
    #pragma pack()
    main()
    printf("Sizeof Class_1 = %d (expected: 6)\n", sizeof(Class_1));
    printf("Sizeof Class_2 = %d (expected: 6)\n",sizeof(Class_2));
    //===========================================================================
    The size of Class_1 should be 6, but get a 8.
    The packing seems to work if the class or struct does not have a ctor.
    Looking thru Sun's web pages I found a bug fix for
    "4199924 pragma pack(x) does not work"
    for C++ v5.0. I am hoping this bug is fixed in v5.2 and that Iam not seeing this bug.
    Thanks
    Leonard

    OK, does anyone atleast encounter this problem with their forte CC compiler at all, is there some patch that fixes this.
    Thanks for responses in advance
    Leonard

  • #pragma pack(1)

    In my project I have hundreds of structures that I need to verify if their members are probably aligned when I turn on #pragma pack(1). I have to do it by hand, but it's very time consuming. Are there any tools, flags that you can use to detect them?
    Thanks,
    Quang

    I'm having a bit of an issue myself. I have a very large struct that has many repeating patters of fields, and a smaller struct I use to overlay as a "sliding window". This works well when all the members are char, but breaks down as soon as I include a number type.
    I have tried using the -xmemalign=1s | 1i options to no success. I am setting #pragma pack(1), and I have also tried #pragma align 1 (structname). Nothing works.

  • Gcc's pragma pack

    I have inherited some linux code which uses gcc's pragma pack(push, n) and pragma pack(pop).
    #pragma pack(push, n)
    #pragma pack(pop)
    When I try to compile this code using gcc on Solaris/sparc I get:
    warning: #pragma pack(push[, id], <n> is not supported on this warning: #pragma pack(pop[, id], <n> is not supported on this target
    Anyone know how I can get past this problem. Is there an equivalent pragma that I can use with gcc for Solaris/sparc. Or is there an way to use something equivalent and compile with Sun studio 11.
    Thanks in advance!

    Sun C and C++ do not support the push and pop extensions to #pragma pack. These extensions cause the compiler to remember previous values of pack on a pushdown stack, so that different include files (for example) can set and restore the pack value without interfering with each other.
    Without this extension, you have to keep track of and manage the packing value yourself.
    That is, suppose you have this sequence:
    #pragma pack (push, 2) /* position A */
    ... declarations using packing value of 2
    #pragma pack (pop) /* restore old pack value */
    You will instead have to know what packing value was in effect a posiiton A, and explicitly set that value instead of using "pop".
    In the most common usage, packing is the default value, and temporarily changed for a few declarations. In that case, you can use this sequence:
    #pragma pack (2)
    .. declarations using packing value of 2
    #pragma pack /* restore default pack value */

  • Support Pack upgrade error in Import Phase

    Hello,
    Currently I am upgrading SCM system with Support pack level 12 to 20 . When i am applying Basis 12 to 20. I got an error in Import_Proper phase.
    Could you please help me on this? I tried and still searching solution for this..But no luck...
    Os is : AIX and
    Log File:                /usr/sap/trans/log/SAPIB70013.xxx
    Main import
    Transport request   : SAPKB70013
    System              : xxxx
    tp path             : tp
    Version and release: 372.04.71 700
    child process 934006 terminated -> setting rc=12 for this import portion
    sap_dext called with msgnr 1:
    db call info -
    function:   db_report_interface
    fcode:      CLOSE_LINE_MODE
    tabname:    SOURCE
    len (char): 40
    key:        CL_OBJECT_COLLECTION==========CT
    retcode:    1
    SQL error -913 accessing  : [IBM][CLI Driver][DB2] DSNT408I SQLCODE = -913, ER
    child process 1212554 terminated -> setting rc=12 for this import portion
    sap_dext called with msgnr 1:
    db call info -
    function:   db_report_interface
    fcode:      CLOSE_LINE_MODE
    tabname:    SOURCE
    len (char): 40
    key:        CL_WDR_APPLICATION_WINDOW=====CT
    retcode:    1
    SQL error -913 accessing  : [IBM][CLI Driver][DB2] DSNT408I SQLCODE = -913, ER
    child process 1171520 terminated -> setting rc=12 for this import portion
    sap_dext called with msgnr 1:
    db call info -
    function:   db_report_interface
    fcode:      CLOSE_LINE_MODE
    tabname:    SOURCE
    len (char): 40
    key:        CL_WDY_MD_EVENT_SOURCE========CI
    retcode:    1
    SQL error -913 accessing  : [IBM][CLI Driver][DB2] DSNT408I SQLCODE = -913, ER
    child process 1331412 terminated -> setting rc=12 for this import portion
    sap_dext called with msgnr 1:
    db call info -
    function:   db_xrtab
    fcode:      RT_MI_LOAD
    tabname:    ECSCR_DATA
    len (char): 106
    key:        EC_TEST_DATA                  00000000P10                           IECATTDEFAULT
    retcode:    1
    SQL error -904 accessing  : [IBM][CLI Driver][DB2] DSNT408I SQLCODE = -904, ER
    insert / update sequence failed due to an error in DBI.
    maybe there's a concurrent process which inserted this table entry at the same time.
    insert / update sequence failed due to an error in DBI.                       
    maybe there's a concurrent process which inserted this table entry at the same time.
    child process 1310922 terminated -> setting rc=12 for this import portion
    sap_dext called with msgnr 1:
    db call info -
    function:   db_xrtab
    fcode:      RT_MI_END
    tabname:    WDY_APP_PROPERTY
    len (char): 64
    key:        DEMO_UIEL_DROPDOWN_BY_IDX     DEMO_VIEW
    retcode:    1
    SQL error -904 accessing  : [IBM][CLI Driver][DB2] DSNT408I SQLCODE = -904, ER
    import portion 018446 - 999999 not imported because the child processes died for unknown reason
    child process 1310924 terminated -> setting rc=12 for this import portion
    sap_dext called with msgnr 1:
    db call info -
    function:   db_report_interface
    fcode:      CLOSE_LINE_MODE
    tabname:    SOURCE
    len (char): 40
    key:        CL_WDY_MD_OUTGOING_EVENT======CT
    retcode:    1
    SQL error -913 accessing  : [IBM][CLI Driver][DB2] DSNT408I SQLCODE = -913, ER
    child process 1286192 terminated -> setting rc=12 for this import portion
    sap_dext called with msgnr 1:
    db call info -
    function:   db_xrtab
    fcode:      RT_MI_LOAD
    tabname:    ECSCR_DATA
    len (char): 106
    key:        EC_TEST_DATA                  00000000P10                           IECATTDEFAULT
    retcode:    1
    SQL error -904 accessing  : [IBM][CLI Driver][DB2] DSNT408I SQLCODE = -904, ER
    import portion 009158 - 018411 not imported because the child processes died for unknown reason
    import portion 018412 - 018527 not imported because the child processes died for unknown reason
    import portion 018528 - 999999 not imported because the child processes died for unknown reason
    sap_dext called with msgnr 1:
    db call info -
    function:   db_xrtab
    fcode:      RT_MI_LOAD
    tabname:    ECSCR_DATA
    len (char): 106
    key:        EC_TEST_DATA                  00000000P10                           IECATTDEFAULT
    retcode:    1
    SQL error -904 accessing  : [IBM][CLI Driver][DB2] DSNT408I SQLCODE = -904, ER
    Main import
    End date and time : 20100909034914
    Ended with return code:  ===> 12 <===
         |   ######################################                     
    Thanks and Regards,
    Sankar
    SAP BASIS Consultant

    Hi,
    Thanks for you reply. I restarted import but no luck still. I activated some object also not working. when i call SPAM it is not going to the SPAM pager. Showing dump...
    Runtime Errors         CALL_FUNCTION_NOT_FOUND
    Except.                CX_SY_DYN_CALL_ILLEGAL_FUNC
    Date and Time          10.09.2010 09:41:37
    Short text
         Function module "POSS_UIREQ_OPT_SUBMIT" not found.
    What happened?
         The function module "POSS_UIREQ_OPT_SUBMIT" is called,
         but cannot be found in the library.
         Error in the ABAP Application Program
         The current ABAP program "SAPLSTXC" had to be terminated because it has
         come across a statement that unfortunately cannot be executed.
    Error analysis
         An exception occurred that is explained in detail below.
         The exception, which is assigned to class 'CX_SY_DYN_CALL_ILLEGAL_FUNC', was
          not caught in
         procedure "OPEN_FORM" "(FUNCTION)", nor was it propagated by a RAISING clause.
         Since the caller of the procedure could not have anticipated that the
         exception would occur, the current program is terminated.
         The reason for the exception is:
         The program "SAPLSTXC" contains the CALL FUNCTION statement.
         The name of the function module to be called is "POSS_UIREQ_OPT_SUBMIT".
         No function module exists with the name "POSS_UIREQ_OPT_SUBMIT".
         All function modules are listed in the Function Library (SE37).
    Possible reasons:
    a) Wrong name specified. Pay particular attenti
        upper/lower case and underscores ("_").
        or
    b) Transport error
    c) In the case of an enqueue/dequeue module,
        the lock object may not have been activated
        (ABAP/4 Dictionary).
    When i tried to check function module it is not there..
    Could you please help on this?
    Regards,
    Sankar Basis Consultant

  • Windows 7 Production Premium CS4 language pack installation error + solution

    Ok. Long story short...(For solution scroll all the way down)
    Tried to install ubuntu next to my windows vista. Next day I found myself wondering in store searching for windows 7 because Ubuntu install ruined something somewhere inside my computer and neither one of my OS were not starting at all...
    Ok. So I purchased Windows 7 with smile in my face and happiness in my soul! Now it´s clean installed and working and I have to say it is much better than Vista was...
    Already installed 3d max 2009 and couple of other old programs and works like charm and softwares are starting fast!
    ...BUT
    Today I tried to install my wonderful CS4 Production Premium package to this computer. All went well all the way to the end report where it said something like "installation error" and then there was few products or files on the list which it was unable to install...(I can post the exact list tomorrow when I try to uninstall and then again install suite the fourth or fifth time in a row.) After error report I was really worried. First I tried to start Photoshop and all I got was error report "some of the application components are missing from the application directory. Please re-install the application." Then I tried Illustrator and the message was "the localized resource files for this application could not be loaded. Please re-install...blah blah..." When I try to open Onlocation I get windows error "Adobe Onlocation has stopped working." Bridge and Media Encoder are working! But when tried to start After Effects, Premiere and Soundbooth it just opened the serial key window. When I write the serial from my dvd-box backlabel it gives me the nice big red X and says that my serial is not valid. But my serial was really valid just a while ago when I started to install these softwares! Oh please NO!
    Ok. So...Questions shortly:
    How to get my Production Premium installation work in Windows 7 and get back to work?
    How to de-activate my softwares after computer breakdown or user stupidity leading to computer breakdown so I can use my softwares again?
    EDIT:
    Well...This is what I got from the error report:
    Adobe After Effects CS4 LangPack (en_GB)
    Error:
    Error 2.
    Adobe Encore CS4 LangPack (en_GB)
    Error:
    Error 2.
    Adobe Flash CS4 Extension - Flash Lite LangPack Common
    Error:
    Error 2.
    Adobe Flash CS4 Payload LangPack (en_GB)
    Error:
    Error 2.
    Adobe Illustrator CS4 LangPack (en_GB)
    Error:
    Error 2.
    Adobe OnLocation CS4 LangPack (en_GB)
    Error:
    Error 2.
    Adobe Photoshop CS4 International English Language Pack
    Error:
    Error 2.
    Adobe Photoshop CS4 International English Language Pack_x64
    Error:
    Error 2.
    Adobe Premiere Pro CS4 LangPack (en_GB)
    Error:
    Error 2.
    Adobe Soundbooth CS4 LangPack (en_GB)
    Error:
    Error 2.
    LangPack (British) for DeviceCentral
    Error:
    Error 2.
    Tried installing different language but it still won´t work...
    Can´t install it in safe mode and installing trough troubleshooters different windows versions won´t work either...
    Any ideas anyone?
    EDIT:
    Tried creating .nrg dvd-images with Nero and installing from harddrive instead of dvd-discs but still no luck. So problem is not in my dvd-drive or discs...
    EDIT:
    SOLUTION...
    Adobe support answered to my question. I was missing a DOCUMENTS folder from my USERS - PUBLIC path and after I created that and un-installed & installed my production premium package, everything worked like it should! You might encounter to this same problem also if your USERS - PUBLIC - DOCUMENTS folder has some security settings on... Just right click the folder, choose security and check full control in permissions and remember to sign in as administrator when you install any software...
    Hope this tip is helpful!
    Now...Back to work!

    WOH, just what I needed.
    My problem was, that I have moved my documents to another partition, but the public parts I unfortunaly don't had thinked about. . This was 'the solution'! Thank you J_Suhonen!

  • Packer install error pgp signature

    I was running AppSet-Qt and in Aur part it said to enable package support you have to install packer.  I tried to install packer with pacman -S but I keep getting errors
    packer-20140817-1-any      9.5 KiB   175K/s 00:00 [#####################] 100%
    (3/3) checking keys in keyring                     [#####################] 100%
    (3/3) checking package integrity                   [#####################] 100%
    error: packer: missing required signature
    :: File /var/cache/pacman/pkg/packer-20140817-1-any.pkg.tar.xz is corrupted (invalid or corrupted package (PGP signature)).
    Do you want to delete it? [Y/n] y
    error: failed to commit transaction (invalid or corrupted package (PGP signature))
    Errors occurred, no packages were upgraded.
    I tried pacman -Sw and still the same.  I also get the same with yaourt packer.

    leonax wrote:Is aur packages a no no then?
    Please read the wiki https://wiki.archlinux.org/index.php/AUR

  • Crystal reports 2008 Service Pack 1 Error

    My reports worked when I was using the packaged Crysatl REports from Visual Studio 2008. However it was slow, therefore I had Service Pack 1 installed and now I'm getting the following error:
    'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception. ---> System.Runtime.InteropServices.COMException (0x800736B1): Retrieving the COM class factory for component with CLSID {5FF57840-5172-4482-9CA3-541C7878AE0F} failed due to the following error: 800736b1.
    Any ideas?
    Thanks in advance!
    LIsa

    I created a new application and I still get the error on the web server. It works fine of my development box.
    The report that I am testing again is simple and only has one text object...
    Any ideas what is missing????
    Thanks agin
    [COMException (0x800736b1): Retrieving the COM class factory for component with CLSID {5FF57840-5172-4482-9CA3-541C7878AE0F} failed due to the following error: 800736b1.]
       CrystalDecisions.CrystalReports.Engine.ReportDocument..cctor() +207
    [TypeInitializationException: The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception.]
       CrystalDecisions.CrystalReports.Engine.ReportDocument..ctor() +0
       CrystalDecisions.CrystalReports.Engine.ReportClass..ctor() +18
       Reports.rptStatement..ctor() +60
       Reports.PrintReport.Page_Load(Object sender, EventArgs e) +57
       System.Web.UI.Control.OnLoad(EventArgs e) +99
       System.Web.UI.Control.LoadRecursive() +50
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint

  • Language Pack installation error

    Getting an error while trying to install ServerLanguagePack_SP2_es-es.exe:
    " La configuracion de Language Pack for SharePoint, Proejct Server and Office Web Apps 2010 - Spanish/Espanol no ha finalizado correctament.
    Error 1706. Setup cannot find the required files. Check your connection to the network or CD-ROM drive."
    I'm installing from a download of the exe, and the network is fine.
    Any recommendations?
    Thanks,
    Scott

    The file should be "oslpksp2010-kb2687462-fullfile-x64-es-es.exe", from http://www.microsoft.com/es-es/download/details.aspx?id=39675
    Trevor Seward
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • Jam pack content error, any ideas?

    Just did a re-install of Logic Studio, and all of the supplied content. When I make a new software instrument track and select a jam pack preset sound from the library browser, it loads the sound just fine, but when I try to select another sound it says "File not found / result code =-43." If I create a new software instrument track, and repeat the process, the same error code comes up. Any idea why it would let me load just a single sound, then give me the error message when I try to select another?

    I don't usually use Jam Packs so today was the first time I've checked to see if they are there. Nope. I only have Jam Pack 1 showing up in my library. I checked GarageBand and it sees all 5, so something is wrong with Logic Studio not seeing them.
    I did a full upgrade from Logic 7 and have never had Jam Packs before (so they are not left over from a previous install). When I did the upgrade, all options were available and I just did a full install, not a custom one. It said it completed successfully.
    Any ideas on how I can get Logic Studio to see the Jam Packs?

  • Reinstall of Crystal Reports XI R2 Service Pack 3 Error

    I needed to do a reinstall of Crystal Reports XI R2 and I am trying to reinstall the service packs. When I try installing SP2 it is saying it is already detected. When I try to install SP3 it is giving me an error that it canu2019t be installed on top of other business objects XI R2 products. Can someone tell me what is causing this and how I can get around it?

    Hi
    You have mentioned that "There are others in my company that after they installed SP3 they were able to successfully connect and I am still getting a login fail error."
    So would like to know the version and type of database that the Universes are based on.off.
    1) Please ensure that you have the exact version and type of the database installed on your machine, that your colleagues are using .
    Say for e.g if the Universes are based off Oracle 9 database, then ensure that you have the Oracle client(version 9) installed on your machine.
    2)Please make sure that you have been added in the user list in the database.
    May be we could come close to narrowing down on the issue by checking these 2 things.

Maybe you are looking for

  • Excel Workbook in Background Processing

    Hello, I have more than 10 queries in an Excel Workbook, all of them are using the same variable and this variable is filled by Exit. The only thing that user need, is Refresh all queries. The time of the query execution is very long, so, we want to

  • After upgrade the MDM 71 Sp3 to SP4 the MDS dos not startet

    Hello, I have an problme after a update from MDM 7.1 SP3 to SP4. The update was finished successful but my MDM Server (MDS) stopped after the starting wiht follow message Starting: /usr/sap/TBD/MDS10/exe/mds-r - Wed Mar  3 10:16:31 CET 2010 SunOS Q4D

  • Upgrading to N access points

    Currently we have 2 WISMs that handle approximately 100 AP's. We are looking to replace our 1242 AP's with the new N 1142's. I was wondering how many clients these 1142's can support compared to the 1242's? Most of our company laptops do not have N c

  • IWeb '09 crashes when I try to delete page.

    Using iWeb '09. Have one website page I cannot open or delete. If I highlight it and press delete ket, or use edit, iWeb crashes. I can relaunch, but cannot delete this page. All other pages act normally. Help?

  • Schedule and deploy

    Hi, I use BO xi 3.1, I have scheduled 20 reports for different clients based on a single template, I can view those reports under the History tab. Is there other way to show me all reports I have scheduled for that template? Also, what is the best wa