Avoiding struct member padding in C

Hello,
The following is a very simple structure, the hand calculated size of which is 6.
On solaris we know that members are padded to word, byte boundaries for better performance.
Hence the sizeof(phone) is 8.
struct phone
unsigned int telno;
unsigned short int code;
In gcc I found a compiler flag called -fpack-struct that avoids the padding bytes in the compiler itself. Is there any such thing with the solaris C compilers.
Using 'pragma pack' is not feasible as the actual intent is to use in a bigger program, that has many such structs and manually going to each struct and changing them is not feasible.
Any compilation facility would be very helpful.
Any pointers that you feel relevant can make a big difference.
Thanking in advance for the help

A couple of things. Unless your structures are unique enough so that different packing is required for each structure, you can use the pack pragma since it holds for the entire file. In other words, a single pack pragma at the beginning of a file effects all the structures from that point on. So, you don't necessarily have to put a different pragma on each structure definition.
Second, you can use the -xmemalign compiler option to alert you when a mis-aligned load or store takes place. So, placing a single pack pragma in each file and compiling with -xmemalign will allow you to track down structures that might need special handling.
You can read about the -xmemalign option here
http://docs.sun.com/source/816-2454/cc_ops.app.html#32726
There does not appear to be a direct replacement for the gcc -fpack-struct compiler flag.

Similar Messages

  • VS/VC++ Struct Member Alignment (set to 4)?

    I would like to ask why Struct Member Alignement is set to 4 instead to Default (or 8 on x64)?
    (in Visual Studio 2008 - Project properties ( -> Configuration  properties) -> C/C++ -> Code Generation -> Struct Member  Alignment)
    There were runtime problems after linking with an external library (default alignment); so it might be better to change the skeleton template in SDK.
    For example in After Effects CS5 SDK for windows in:
    after_effects_cs5_sdk_win\Adobe After Effects CS5 Win SDK\Examples\template\Skeleton\win\Skeleton.vcproj
    look for:
    StructMemberAlignment="3"
    and set it to 0 (default) or at least to 4 (64bit alignment)
    StructMemberAlignment="0"
    or
    StructMemberAlignment="4"
    greets
    m

    Hi Mike,
    I believe you're correct, thanks for pointing that out.  These projects had been brought forward from the CS4 versions, which were 32-bit, and used 4-byte alignment at the time.  Fortunately, the standard headers include PreConfig.h, which sets 8-byte alignment for the AE API structure definitions.  But it makes sense to no longer set 4-byte alignment in the vcprojs.
    Cheers,
    Zac

  • SS9 CC5.6 compiler bug - algorithm count confused with struct member

    Found some code that fails to compile in CC 5.6
    CC: Sun C++ 5.6 2004/07/15
    #include <algorithm>
    using namespace std;
    struct A {
      int count;   
    struct B
      struct A *a;
    int main(int argc, char **argv)
      struct B *b = 0;
      // This line fails to build, any other operator is ok
      if ( b->a->count < 50 )
      return (1);
    }Fails with error :
    "c56_algorithm_bug.cpp", line 21: Error: Unexpected ")" -- Check for matching parenthesis.
    "c56_algorithm_bug.cpp", line 22: Error: "," expected instead of "{".
    "c56_algorithm_bug.cpp", line 22: Error: Illegal value for template parameter.
    "c56_algorithm_bug.cpp", line 22: Error: ")" expected instead of "{".
    4 Error(s) detected.The compiler is getting confused with the use of the count struct member vs the count algorithm. Changing the < to a > fixes the problem.
    Using CC5.3 works fine as well as all other compilers we use (gcc 3.4, mipspro 7.4, VC 7.1)
    Anyone seen this ?
    - mark

    This bug has been fixed in the C++ 5.6 compiler. I'm not sure if the fix is in the first patch which is about to be released. If not, the fix definitely will be in the next patch.
    The workaround is not to use
    using namespace std;That using-declaration is a pretty big hammer, and often results in conflicts with user code, compiler bugs aside.

  • Dll struct member alignment

    I need information about the struct member alignment setting when compiling DLLs for use with LabVIEW. In my DLL, I also make function calls to a rendering library, VTK, that was compiled with 8 byte alignment. My DLL will only work if compiled with 8 byte alignment. If I compile it with 1 byte, I get obvious bad struct alignment issues and functions that perform deep copies to struct members cause fatal memory errors, which makes sense. But I'm confused since the LabVIEW documentation says that the struct member alignment should be set to 1 byte for all projects.
    So why does it work with 8 byte?
    Am I taking a risk by using 8 byte?
    If I only make calls to the 8 byte compiled library then is it even an issue?
    Should I compile the rendering library with 1 byte so that I can compile my DLL with 1 byte as well?
    Are LabVIEW CIN functions compiled with 1 byte; is that the reason?
    I guess I just need to know why DLLs for LabVIEW should be compiled with 1 byte alignment and if this rule can be bent.
    Any information is greatly appreciated.
    thank you,
    Louis

    Lou 83 wrote:
    I need information about the struct member alignment setting when compiling DLLs for use with LabVIEW. In my DLL, I also make function calls to a rendering library, VTK, that was compiled with 8 byte alignment. My DLL will only work if compiled with 8 byte alignment. If I compile it with 1 byte, I get obvious bad struct alignment issues and functions that perform deep copies to struct members cause fatal memory errors, which makes sense. But I'm confused since the LabVIEW documentation says that the struct member alignment should be set to 1 byte for all projects.
    So why does it work with 8 byte?
    Am I taking a risk by using 8 byte?
    If I only make calls to the 8 byte compiled library then is it even an issue?
    Should I compile the rendering library with 1 byte so that I can compile my DLL with 1 byte as well?
    Are LabVIEW CIN functions compiled with 1 byte; is that the reason?
    I guess I just need to know why DLLs for LabVIEW should be compiled with 1 byte alignment and if this rule can be bent.
    Any information is greatly appreciated.
    thank you,
    Louis
    LabVIEWs structures are indeed packed, with 1 byte alignment on most systems. (I think that Sparc is an exception to this as it has very bad performance when accessing a memory address which is not a multiple of its size. But 1 byte alignment is not bad at all if you need a different alignment you really only have to investigate the structures and find out where the compiler would fill in extra bytes and add them on the LabVIEW diagram to the cluster yourself. As a rule a value is aligned to a multiple of its own size or the compiler specified alignment, whichever is smaller. 8 byte alignment does for instance not mean that an int32 would be aligned to a multiple of 8 byte but to a multiple of 4 bytes only as that is its own size. Only doubles would be aligned to 8 bytes really (and long long, but they are not directly supported by LabVIEW.)
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Avoid local member from shared row axis report

    Hi,
    I have developed reports, and shared onereport with default report with row axis,
    when i merge the two report the local member applicable to the another report which will i don't required the formula.
    but one report don't need sum function at the end of the reach column. Row axis is dynamic.
    ex:
    total.2012
    total.2013
    total.2014
    account_1
    34
    account_2
    144
    total
    178
    not need the sum
    not need the sum
    Regards.
    surya

    You can use the EPMFormattingSheet sheet to clear the intersection of the local member Total and Time.Year <> 2012
    You must use the Multiple Selection functionality, follow this steps:
    1) In section Dimension Member/Property Formatting, section Column click the button Add Member/property
    2)  Select tab Property Selection, select dimension: TIME, property: YEAR, operator: <> and value: 2012. Then click the button "Add to Multiple Selection"
    3) Select tab Specific Selection, select Local Member option and enter the name of the local member, in this example is LocalMember000.Then click the button "Add to Multiple Selection"
    4) Select tab Multiple Selection Overview to validate the previous selections.
    5) Click OK
    6) Check the option Apply
    7) Change the conten of the cell with the formula =""
    8) In columns Use change the value "All" to value "Content"
    Hope this helps.

  • Data File-- atleast one member from each dimension is it mandatory??

    Is it mandatory to have atleast one member each dimension in the data file that is used for loading into the Cube?If we leave one member from a dimension is it going to create a problem?So, If I want to load with different data files for different members of measures & is there any way to avoid extraneous member ( from one Dimension, the reason is cuz there are 2 dimensions out of which one may need not be actually included in the text file ) in the data file??Your views about this will be appreciated!!Thanks

    In a load rule file, you can create something called a header - which can be used to specify member(s) that do not appear in the data file.To specify a header, choose Options / Data Load Settings / Header Definition. The caveat is that you can only choose one member from the missing dimension - you cannot specify multiple members from the same dimension. If that is the case, then the members will have to be in the data file.Regards,Jade---------------------------------Jade ColeSenior Business Intelligence ConsultantClarity [email protected]

  • SQL Query to fetch a specific field in xml

    Hi,
    Below is my sample Xml file.
    <?xml version = "1.0" encoding = "UTF-8"?>
    <methodCall xmlns = "http://www.tibco.com/schemas/CS4_new1/Schema.xsd" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation = "http://www.tibco.com/schemas/CS4_new1/Schema.xsd Schema_new.xsd">
    <methodName>rBatchFile </methodName>
    <params>
    <param>
    <value>
    <struct>
    <member>
    <name>filename</name>
         <value>
         D:\test.txt
         </value>
    </member>
    <member>
    <name>batchId</name>
    <value>
         L1
    </value>
    </member>
    </struct>
    </value>
    </param>
    </methodName>
    </methodCall>
    I want to query a "value" field based on the "name" field. I tried with the following query which didnt work.
    SELECT a.extract('//value/text()' , 'xmlns:="http://www.tibco.com/schemas/CS4_new1/Schema.xsd" ')
    FROM ( SELECT t.customerinfo.extract('//member[name="filename"]','xmlns:="http://www.tibco.com/schemas/CS4_new1/Schema.xsd" ')
    FROM cust_order t ) a;
    Please do provide the SQL query ASAP.

    with tab as (
    select xmltype('<?xml version = "1.0" encoding = "UTF-8"?>
    <methodCall xmlns = "http://www.tibco.com/schemas/CS4_new1/Schema.xsd" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation = "http://www.tibco.com/schemas/CS4_new1/Schema.xsd Schema_new.xsd">
    <methodName>rBatchFile </methodName><params>
    <param>
    <value>
    <struct>
    <member>
    <name>filename</name>
    <value>
    D:\test.txt
    </value>
    </member>
    <member>
    <name>batchId</name>
    <value>
    L1
    </value>
    </member>
    </struct>
    </value>
    </param>
    </params>
    </methodCall>
    ') a from dual
    --end of sample data
    SELECT
      extractvalue(column_value,'/member/name') name,
      extractvalue(column_value,'/member/value') value
    from tab t,xmltable('xmlns = "http://www.tibco.com/schemas/CS4_new1/Schema.xsd" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation = "http://www.tibco.com/schemas/CS4_new1/Schema.xsd Schema_new.xsd"','for $i in //member return $i' passing t.a)An example...but i tweaked the xml...check the xml namespace once before executing...
    without adding the namespaces...code will be like...
    with tab as (
    select xmltype('<?xml version = "1.0" encoding = "UTF-8"?>
    <methodCall >
    <methodName>rBatchFile </methodName><params>
    <param>
    <value>
    <struct>
    <member>
    <name>filename</name>
    <value>
    D:\test.txt
    </value>
    </member>
    <member>
    <name>batchId</name>
    <value>
    L1
    </value>
    </member>
    </struct>
    </value>
    </param>
    </params>
    </methodCall>
    ') a from dual
    --end of sample data
    SELECT
      extractvalue(column_value,'/member/name') name,
      extractvalue(column_value,'/member/value') value
    from tab t,xmltable('for $i in //member return $i' passing t.a)Ravi Kumar

  • What are the code library function settings should be followed

    i have written one win32 dll, in that what are the project settings should i follow to access the dll file from the lab view..
    i have done the following changes but still its not working,
    1. Added the library.lib to the dll from the installed path of lab view
    2. project settings > settings for All configuration
    >C\C++ : category :code generation
    use run time lib : Multi threaded dll
    processor : blend
    struct member allignment :1 byte
    call convention : _cdecl*
    For my driver access i have included the sys file.
    is that anything i have to do other than this,  please tel me the config i hav do for the access

    2716jag,
    How are you trying to access the DLL from LabVIEW?  Have you tried using the Call Library Function Node?  This should allow you to access the functions within the DLL.  I hope this helps!
    Brian T
    Applications Engineer

  • Help me: addParameter problem!!!!

    Hello
    I need to call a Web Service by XML-RPC. I want to make use of the JAX-RPC library provided by sun.
    The XML file that needs to be send to the server, looks something like:
    <?xml version="1.0" encoding="UTF-8" ?>
    <methodCall>
    <methodName>refresh</methodName>
    <params>
    <param>
    <value>
    <struct>
    <member>
    <name>name 1</name>
    <value>
    <struct>
    <member>
    <name>name 12</name>
    <value>
    <string>value 12</string>
    </value>
    </member>
    <member>
    <name>name 13</name>
    <value>
    <string>value13</string>
    </value>
    </member>
    </struct>
    </value>
    </member>
    <member>
    <name>name2</name>
    <value>
    <struct>
    <member>
    <name>name 21</name>
    <value>
    <string>value21</string>
    </value>
    </member>
    </struct>
    </value>
    </member>
    <member>
    <name>name 3</name>
    <value>
    <struct>
    <member>
    <name>name 31</name>
    <value>
    <struct>
    <member>
    <name>name311</name>
    <value>
    <double>value 311</double>
    </value>
    </member>
    <member>
    <name>name312</name>
    <value>
    <double>value312</double>
    </value>
    </member>
    <member>
    etc�.
    As you can see the parameters are nested.
    Now I want to add the parameters using: addParameter, but since these are nested, I wonder how to do this.
    I think I need something like:
    AddParameter(�name1�, XSD_QNAME, IN)
    AddParameter(�name12�, XSD_STRING, IN);
    AddParameter(�name13�, XSD_STRING, IN);
    Object[] params={??<WHAT DO I PUT HERE>??, new String(�value 12�), new String(�value 13�)}
    But HOW do I tell java there is a level above this parameter, namely another parameter �name 1�, with as value a sub level?
    Please can anybody help me on this?

    Does anybody have an idea?

  • 64 bit Illustrator CS6 plug-in - CSXSEvent bad pointers

    Hi
    I am having difficulty with a x64 bit compile of our plug-in with regards to PlugPlug events dispatched from Flash panels. Under 32bit operation, all seems to be fine. XML is dispatched from Flash and it received without problem in the C++ plug-in. However under 64bit architecture, the CSXSEvent is received with invalid pointers. Here's the data received:
    Under 32bit operation, the data field contains XML content without fail. However here it's acting strangely. I've tried compiling the Flash extension under different SDK versions (Extension Builder 3.4 & 4.5) plus also tried the CSXS extensions 2.0 & 3.0 but with no joy. The event is getting captured correctly, firing into the plug-in instantly, but the appId, extensionId and data are all missing.
    I'm not doing anything special from Flash, this works fine under CS6 x32:
                protected function btnLogin_clickHandler(event:MouseEvent):void
                    var objSaveEvent : CSXSEvent = new CSXSEvent("net.desl.ai.events.Security.Login", CSXSEventScope.APPLICATION);
                    var objData: XML = new XML("<login><username>" + tbUsername.text + "</username><password>" + tbPassword.text + "</password></login>");
                    objSaveEvent.data = objData;
                    //Send the data to the plugin
                    var blnResult : Boolean = CSXSInterface.getInstance().dispatchEvent(objSaveEvent);
    Any help appreciated, or pointers of where I should look or have gone wrong.
    Thanks

    Hi
    I have managed to resolve the issue. Here's what I found if it is of any interest to anyone else. I noticed that the event.data bytes were reversed (big/little endian order?). I managed to hack it by reversing the bytes by shifting the bits left and right (event.data << 32 | event.data >> 32). That actually displayed the XML from the Flash panel!
    However the dispatch still did not work.
    I looked deeper into the CS6 sample FreeGrid and noticed that the "Struct Member Alignment" on the project was set to 8 bytes (/Zp8). The settings on my project was actually set to 4 bytes (/Zp4). On changing that to 8 byte alignment, suddenly all functionality returned back to normal. I'm not sure how PlugPlug was sending the data through, but seemed it was coming into the  CSXSEvent structure incorrectly.
    Not sure if this was a silly mistake on my part, but the 32 bit version has been happily working for quite a while now.
    I've been using Visual Studio 2008 btw.
    Thanks

  • Cc [feb build] hogs memory

    cc: Sun C 5.9 Linux_i386 Build40_1 2007/02/09
    My machine has 1GB ram, and 2GB swap. One one source file - it goes berserk allocating all the available memory [in this example 1.6Gb - before its killed]
    Mem: 1032340k total, 1019564k used, 12776k free, 600k buffers
    Swap: 2096440k total, 1151580k used, 944860k free, 14572k cached
    PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
    26669 balay 30 15 1629m 897m 304 D 11.6 89.0 0:27.41 iropt
    So I attempt to file a bugreport with the preprocessed source file causing this behavior. However this sourcefile refuses to compile [another bug in the compiler?]
    >>>>>
    asterix:/home/balay/spetsc/src/ksp/ksp/impls/cg/gltr>sun-cc -c gltr-pre.c
    "gltr-pre.c", line 2531: warning: attribute "__mode__" is unknown, ignored
    "gltr-pre.c", line 2531: warning: attribute parameter "__HI__" is undefined
    "gltr-pre.c", line 2532: warning: attribute "__mode__" is unknown, ignored
    "gltr-pre.c", line 2532: warning: attribute parameter "__SI__" is undefined
    "gltr-pre.c", line 2533: warning: attribute "__mode__" is unknown, ignored
    "gltr-pre.c", line 2533: warning: attribute parameter "__HI__" is undefined
    "gltr-pre.c", line 2534: warning: attribute "__mode__" is unknown, ignored
    "gltr-pre.c", line 2534: warning: attribute parameter "__SI__" is undefined
    "gltr-pre.c", line 2912: warning: attribute parameter "__printf__" is undefined
    "gltr-pre.c", line 2916: warning: attribute parameter "__printf__" is undefined
    "gltr-pre.c", line 2936: warning: attribute parameter "__scanf__" is undefined
    "gltr-pre.c", line 2940: warning: attribute parameter "__scanf__" is undefined
    "gltr-pre.c", line 2945: warning: attribute parameter "__scanf__" is undefined
    "gltr-pre.c", line 5158: warning: unnamed struct member
    asterix:/home/balay/spetsc/src/ksp/ksp/impls/cg/gltr>
    <<<<<<<
    - Is this a known problem?
    - If not - how should I file a bugreport?
    thanks,

    ok '-O' is causing the problem
    asterix:/home/balay/spetsc/src/ksp/ksp/impls/cg/gltr>sun-cc -c -O x.i
    cc: Fatal error in /home/balay/soft/sunstudio12/prod/bin/iropt : Signal number = 11
    cc: iropt failed for x.i
    This is a different behavior than when preprocessing was not used [where it just keeps allocationg memory]. I can e-mail the code that reproduces this bug.
    thanks,

  • For Experts: Why does LabView cause System reboot while accessing hardware with driver?

    Hello NI Developers!
    I use LabView 7.1 under Windows XP
    I have a programm console application which accesses through Jungo Windriver PCI-E board.
    This program works fine - and performs DMA data transfer between PC and Board's memory.
    In order to implement this console application work together with LabView I did following:
    1) Added this function inside the source:
     _declspec(dllexport) void LVMainFunction(uInt32 *IntValue);
    _declspec(dllexport) void LVMainFunction(uInt32 *IntValue)
        AllocConsole();                   //Open new console window
        SetConsoleTitle(L"Debug Window"); //Set a title for console window
        freopen("CONOUT$","a+",stdout); //redirec standard output stream to current window so
                                        // so we are able to see "printf" outputs
       freopen("CONIN$","a+",stdin);    //redirec standard input stream to current window so
                                        // so we are able pass inputs from keyboard
       main();                          //Call applications main function which does all the work
    2) Compiled this new source as DLL library
    3) Call  LVMainFunction(...) function from LabView using Call Library Node
    In the result: Executing VI - opens new console window, shows debug outputs and receives keyboard inputs.
    It works fine till the last function, which perform DMA data transfer - and reboots PC.
    1) Why does this happen?
    2) I understand that opening console from Call Library Node, attaches together this console window and running VI. So If I close one of them - both windows closes.
         So does LabView have somekind of restrictions of accessing Hardware's functions? 
    I can read Board's resource information and view size of memory on board, interrupt functions and other information about device, but when I try to reach
    DMA my system reboots. And I understand that this should be some kind of LabView problem, cause I tried different implementations, even without use of
    console window - and the result is the same.
    3) Should I split the program in to two separate processes and perform data exchange using Sockets or Pipes techology?
    Thank you in advance!
    ACiDUser
    Message Edited by ACiDuser on 11-13-2008 09:37 AM

    Hello!
    At LAST!!!
    I solved this problem!
    From the beginning I was following National Instruments manual on how to build DLL with external IDE:
      http://zone.ni.com/reference/en-XX/help/371361A-01​/lvhowto/building_library_project/
    Set the Struct member alignment control to 1 Byte.
    Now this option caused my PC to reboot!
    So could someone explain  why this happened? and If it is a bad tip, so it's better to remove from manual. Then other people will not have such problems as I did
    - wasting 2 monthes of time determining the problem. 
    I changed it to  Set the Struct member alignment control to DEFAULT.
    and now everything works fine.
    Regards
    Message Edited by ACiDuser on 11-13-2008 11:14 AM

  • Loading Comman members in diffrent Dimension(ASO)

    Hi,<BR><BR> i ahve a situvation where in my time dimension i have year as 2000 and also in My equipment dimension i have my equipment model as 2000. so when i load my equipment the member load erros out as no shared member wanted. but as i am using ASO i cannot user shared member(i think so as it gives an error says shared members not allowed in ASO when trying to save the outliene). how do we hnadle thi ssutuvation

    My recommendation would be to add a prefix to your year members "Year 2000" -- you could do this as an alias. Then in your dataload, either modify the data or use a load rule which provides the prefix in the time column. Minor details may need to be worked out, but in the end, it's a bad idea to have a "2000" member for both time and equipment -- for that matter, I recommend avoiding numeric member names in general (formatting issues in Excel, etc...).<BR><BR>Thats just my 2 cents worth, FWIW. <img src="i/expressions/face-icon-small-smile.gif" border="0"><BR>

  • How to properly create complex OCI objects (for Annotation Text)

    I am upgrading a tool that will upload text objects to a table with a ST_ANNOTATION_TEXT field. The app is a C++ app and I need to instantiate a ST_ANNOTATION_TEXT (using OCIObjectNew??). I actually have 2 questions. First, does anyone have an example of how to accomplish this? I seem to be unable to correctly create the annotation text type in C++ to be able to append to (calling OCICollAppend). Second, since ST_ANNOTATION_TEXT is a complex type (contains an array of annotation text elements), do I need to call OCIObjectNew on not only the main ST_ANNOTATION_TEXT type but also for the ST_ANNOTATIONTEXTELEMENT_ARRAY, ST_ANNOT_TEXTELEMENT_ARRAY, and the ST_ANNOTATIONTEXTELEMENT?
    I can't seem to find in info on this so hopefully someone else has been through this.

    user3068343 wrote:
    I am still having an issue where the sub objects are still NULL.Actually I was mistaken. I must have confused getting an Object from OCIObjectNew with using one of its constructor method in a statement.
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28395/oci18nav004.htm#sthref3438 clearly state the object will have NULL attributes, unless the OCI_ATTR_OBJECT_NEWNOTNULL flag is set on the environment handle.
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28395/oci11obj.htm#i446308 further tells you what the default value for the object members will be.
    An older 9i doc http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96594/adobjadv.htm#1008774 also warns about resetting the indicator struct member when you update a member of the object.
    user3068343 wrote:
    ++a) you allocate the object's top-level struct yourself (SDO_GEOMETRY in my case) in C+++
    Above you suggest creating the objects top-level struct myself. How do you create that top level object? I have been using OCIObjectNew on that object as well as its sub objects? Is that how you are creating the top-level object?This technique works only on binds, as objects you get back from defines are always allocated from the object cache. I create the top-level object directly on the stack... This is something I discovered worked, but is not documented, so you're probably on safer ground using OCIObjectNew instead.
    BTW, the reason I can't easily post OCI example code is that my code uses wrappers around the objects that hides most of the OCI:
    Geometry Geometry::make_point(OCIEnv* envhp, OCIError* errhp, float x, float y) {
        Geometry point_geom(envhp, errhp);
        point_geom.set_null(false);
        point_geom.gtype() = 2001;
        PointRef point = point_geom.point();
        point.set_null(false);
        point.x() = x;
        point.y() = y;
        return point_geom;
    }The above creates an 2D point-type SDO_GEOMETRY hidden inside the Geometry class, itself deriving from a GeometryRef class. The latter wraps a C++ API on top of the struct pointers for a SDO_GEOMETRY/SDO_GEOMETRY_ind, while Geometry actually composes the OTT generated value/indicator structs by value, and passes addresses to its nested structs to GeometryRef (its parent class). So GeometryRef can manipulate an object irrelevant of where it was allocated, the stack or the object cache. The Geometry class is a value class, but it's useful for binds only, and like I said uses a behavior which appears to work but is not explicitly documented.
    Unless you have nested objects by reference, nested objects are composed by value in the OTT-generated structs, so the space for all nested objects is already allocated after the first OCIObjectNew. But the members themselves are not initialized, and thus marked as null in the indicator struct.
    In the code above, my Geometry instance is fully allocated (on the stack), but fully uninitialized (the indicator is by default set to all nulls). I first set the atomic flag to non-null, then get the Ref wrapper around its nested SDOPOINT_TYPE to also set it to non-null, and fill in the x/y member (via another NumberRef wrapper, which knows about the member and the indicator for that member, and sets it as non-null when assigned to). Notice how how I return the instance by copy: My point geometry instance doesn't have a pointer-aliasing issue here, only because its two OCIColl* are null. In the general case, you can't copy my value wrappers without making a true deep copy... But I'm getting into the weeds here.
    The important point is that OCIObjectNew doesn't init the nested objects unlike what I stated earlier. Sorry for misleading you on that. --DD                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Extracting a value

    Hi,
    Please assist: I am retrieving the following xml from a RPC call. How can I extract the voucher number from the xml? Many thanks
    <?xml version="1.0" encoding="iso-8859-1"?><methodResponse><params><param><value
    <struct><member><name>voucherNumber</name><value><string>7353587758481235</string></value></member><member><name>terminalID</name><value><string>0029688692</st
    ring></value></member><member><name>resultCode</name><value><int>1</int></value>
    </member><member><name>balanceAmount</name><value><int>58500</int></value></memb
    er><member><name>expiryDate</name><value><dateTime.iso8601>20090630T00:00:00</da
    teTime.iso8601></value></member><member><name>resultText</name><value><string>OK
    </string></value></member><member><name>serverTransactionID</name><value><int>20
    58261</int></value></member><member><name>authNumber</name><value><string>3390</
    string></value></member><member><name>clientTransactionID</name><value><string>2
    00</string></value></member></struct></value></param></params></methodResponse>

    Hi, try this:
    select extractvalue(member.column_value, '/member/name') name, extractvalue(member.column_value, '/member/value/string') value from
    table(XMLsequence(extract(
    XMLType('<?xml version="1.0" encoding="iso-8859-1"?><methodResponse><params><param><value>
    <struct><member><name>voucherNumber</name><value><string>7353587758481235</string>
    </value></member><member><name>terminalID</name><value><string>0029688692</string>
    </value></member><member><name>resultCode</name><value><int>1</int></value>
    </member><member><name>balanceAmount</name><value><int>58500</int></value>
    </member><member><name>expiryDate</name><value>
    <dateTime.iso8601>20090630T00:00:00</dateTime.iso8601></value></member>
    <member><name>resultText</name><value><string>OK</string></value></member>
    <member><name>serverTransactionID</name><value><int>2058261</int></value></member>
    <member><name>authNumber</name><value><string>3390</string></value></member>
    <member><name>clientTransactionID</name><value><string>200</string></value>
    </member></struct></value></param></params></methodResponse>'), '//member'))) member
    where extractvalue(member.column_value, '/member/name') = 'voucherNumber';
    Regards,
    Paweł

Maybe you are looking for

  • I can not access my iphone(3Gs) after update my software from 4.1 to 6.1.3

    this message appered after update your iphone could not be activated.........................

  • Why does my ipod touch turn down volume

    I've had my ipod touch for a long time, but since a week it has been having problems. Whenever I start my ipod touch, it automatically turns off the volume. I'm not able to put up the volume with the buttons on the side. Whenever I turn up the volume

  • Grouping data sent to servlet

    I have an applet servlet pair and I'm having trouble grouping the data coming in from various clients. Let's say there are five clients connected to the servlet on individual threads. The data from clients A, B, and C need to be grouped together, whi

  • Clone function in Aperture 2.0

    I have used the Aperture 2.0 clone feature when the program was first release with no problem. However, tonight when I use the clone feature the cloned color seems to be "absorbed" in the new location. I identified what area to clone and selected a "

  • Java package

    Hi I'm facing some problem with package. Currently my project import some classes from the file abc.jar. Before including the package keyword for my new class, everything compiles. However after I tried adding for example package testing; at the top