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

Similar Messages

  • 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

  • MSA copying activity: flag 'main team member' not set automatically

    Hello forum,
    when I copy an activity in msa,
    the responisble persons are copied too, but saving is not possible:
    error: flag main team member not set
    So i have to set this flag manually.
    Why does the system not copy this flag too ?
    Where can I change this bad behaviour ?
    Thanks
    Gerd

    Hello,
    did you already check the following:
    1) activities created in CRM have this main flag set properly for exactly one responsible employee defined for this function
    2) customizing is synchronized properly to CDB/Mobile:
    CRM_DNL_PAR_FCT
    CRM_DNL_PAR_PDD
    CRM_DNL_PAR_PDP
    CRM_DNL_PAR_UIS
    3) activities downloaded to mobile have this main flag set properly for exactly one responsible employee defined for this function
    4) it is possible to create the same activities in mobile as in CRM using the same functions (e.g. the customizing is proper on mobile)
    For my understanding I would rather suggest to change/correct the data in CRM instead of modifying the copy functionality for mobile.
    Regards,
    Wolfhard Bierlein

  • Unable to locate page align set-up

    I recently changed all 4 ink cartridges, but the print is printing blank pages.  unable to locate the page alignment set-up

    Hello Millie1177,
    Welcome to the HP Forums! I understand your concerns. What type of printer do you have? Click here to find out: Model Number.
    Once you verify this information I will assist you further.
    Looking forward to hearing from you.
    I worked on behalf of HP.

  • 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.

  • How to change the default left alignment setting in Word 2010 professional (personal use)

    Hi, I use Word 2010 Professional for my personal use at home, and somehow the default setting for the left alignment in a new Word document has been changed to a hanging indent at .25.  So every time I open a new Word  document, the left margin
    has an indent setting.  I have to change it to 0.0 every time, which is annoying.
    I've tried to go into the "Options" section, under "Custom Settings" to de-select an auto left margin indentation, but I can't seem to find an option to do that.  Can anyone please tell me how to change this setting in the master Word 2010 template,
    so that every time I open a new doc, the left side is aligned at the 1" margin with no hanging indent?
    Thank you.

    Page Layout-Page Setup-Margins-Custom Margins...-change your setting-Set As DefaultStay Hungry, Stay Foolish

  • 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.

  • Paper alignment set up

    I am setting up a new officejet 4630 and have got to the printing alignment stage.  I've inserted paper, small amounts and larger amounts, but the printer won't pick up the paper and simply says 'load plain paper'.  It doesnt make any beep when I insert the paper.  I'm using HP everyday printer paper. Any ideas?

    Hi @JKLP ,
    I see that you are experiencing issues with the paper feed when trying to do the alignment on the new printer. You are getting a message to 'load plain paper'. I would like to help you resolve this issue.
    Make sure the printer is connected directly to a wall outlet. (don't use a power hub or a surge protector) This ensures the printer is receiving full power and may help this situation.
    Please take a look at this document to see if it will help.
    An 'Out of Paper' Message Displays on the Control Panel and the Printer Does Not Pick Up Paper.
    If you need further assistance, just let me know.
    Have a great day!
    Thank You.
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos Thumbs Up" on the right to say “Thanks” for helping!
    Gemini02
    I work on behalf of HP

  • 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

  • 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

  • Stack corrupted around CNiPointers

    Hi,
    I'm trying to convert a Measurement Studio project from 6.0 to 8.1.1 for Visual Studio 2005. It's a LabView callable DLL which uses UI components. When I run it in debug mode I get numerous Run-Time Check Failures saying that the stack is corrupted around local CNiPointers objects. I also get corruption of locals on the stack near calls to CNiGraph::GetAxes() and GetPlots(). One common thing among all the problem areas is the use of .Item() on objects of type CNiPointers, CNiAxes, and CNiPlots. In release mode I have also seen evidence of stack corruption in those areas.
    Is there a problem with those NI classes or do I have some project setting wrong?
    Thanks.
    Claus

    Hi, Jonathon,
    Thanks for the quick response. I am happy to give you more info, including tests I've done already, and to try your suggestions. Here are anwers to your points:
    - Yes, everything worked fine in 6.0. When it came time to upgrade, I first tried to build it under Visual Studio 2005 with the original Meas. Studio 6.0 headers and libs but it wanted to link the old MFC libs and could not find them. So I installed Meas. Studio 8.1.1 (I was afraid to install 8.1.2 from the December CD set because of "risk of bodily injury") and deleted the old headers and libs from the project. It recompiled and linked just fine.
    - Yes, the stack corruption breakpoints happened the first time I ran in debug mode. When I turned off the stack checker, I got some bogus failures warning of using uninitialized variables. I say "bogus" because when I step through the code, the variables are clearly initialized. I suspect that the unchecked stack corruption is confusing the variable checker. When I turned that off as well, the debug code worked correctly. However, the release build still failed. I added some tracing dumps to the release build and saw that a local variable called "bRet" was being clobbered by this unrelated line of code:
    m_graph.GetAxes().Item(1).SetMinMax(m_dXAxisMin, m_dXAxisMax);
    but only in release mode - the debug build did not change the value of bRet! I took that as more evidence of stack corruption.
    - Yes, the stack check breakpoints always occur in the three places I mentioned in the first post and the release mode failure always occurs as above (given the same app test conditions). Another interesting test result is that, if I turn on speed optimization, then the release build does not fail as above. Rather, it causes the LabView app to abruptly exit completely without any dialog or warning!
    - I will try to build and run a similar NI example. If that works fine, I'll try to strip down my project and demonstrate the failure.
    - The error says "Run-Time Check Failure #2 - Stack around the variable 'pointers' was corrupted." The local variable declaration is:
    CNiPointers pointers = m_sliderWnd.GetPointers();
    If I stick a "return;" just after that line, I get the same message but if I put "return;" just before that line, I get no error there!
    - I am calling the debug DLL from LabView. And the debug DLL is calling release builds of the Meas. Studio libraries. Is there any way to link in debug versions of these libs? It would be great to step through some of the NI code (at least the top, non-proprietary layers) like you can with MFC libraries.
    So I hope you can see why I suspect true stack corruption within the calls into those NI classes. Maybe I have some build setting wrong. This project was automatically converted by Visual Studio 2005 from the old one. I also tried creating a new Meas. Studio project and compared its settings with mine. I then changed some of my settings to match but to no avail. The only one I did not change was the "Struct Member Alignment". The new project used "8 Bytes" but mine requires "1 Byte" because it must parse LabView arrays and clusters.
    Thank you for your attention.
    Claus

  • Vertical alignment is middle regardless of setting

    Running LiveCycle Designer ES 8.2 and Adobe Acrobat Pro 9 on Windows 7.
    I'm designing a form with many text fields.  Most of them work great.  However, I several text fields--some standalone, some table cells--where the vertical alignment of the user-entered value always shows as middle. 
    For example, this text field has the vertical alignment set to bottom, using the paragraph pallette:
    This is the same field with the alignment set to top:
    And this is the same field again, with the alignment set to middle:
    You will notice that they all look the same--always middle.  I'm able to set the caption alignment fine, and I'm aware of the way to distinguish between adjusting the caption and value properties in the paragraph pallette. 
    I can't determine any pattern as to why some of my text fields align fine according to the settings I specify, and some of them are always, always middle-aligned. 
    Are there any other settings or conditions which may be overriding my alignment settings for these specific fields? 
    It first started happening with table cells, so I assumed some table setting was causing the problem (although I never found it). Once standalone text fields started doing it too, though, I was extra stumped. 
    I am able to adjust all the horitzonal alignment settings fine.  I have tried deleting the offending cells and starting from scratch, but it hasn't helped.
    Any suggestions or help would be appreciated!
    Thanks,
    Marybeth

    This seems odd, but you need to also set the property JAVASE_DB_INTERACTION to false.
    <p>
    propertiesMap.put(EntityManagerFactoryProvider.JAVASE_DB_INTERACTION, "false");
    <p>---
    <br>James Sutherland
    <br>Oracle TopLink, EclipseLink
    <br>Wiki: Java Persistence, EclipseLink

  • Setting Vertical alignment

    I know how to set vertical alignment in a Microsoft Word document.
    I have been unable to find out how to do the same thing in Pages '08.
    I know it has to be there because if I open a document in Pages that was created with Microsoft Word that has vertical alignment set to center it is recognized by Pages.
    Any suggestions??
    Peter

    I do not think it is available through the UI. The way to add vertical alignment to a page is to copy a page from a converted Word document and paste it to your Pages document.
    It does not seem like Pages XML is currently fully documented, even though it has been claimed to be. I thought it would be here but that is not for the current version, and it is incomplete.
    I would guess it is this kind of information:
    <pre>
    <sf:verticalAlignment>
    <sf:number sfa:number="1" sfa:type="i"/>
    </sf:verticalAlignment>
    </pre>
    However, searching Apple's developer connection gives no confirmation.

  • Custom Table Cell Renderer Unable To Set Horizontal Alignment

    Hello,
    I have a problem that I'm at my wit's end with, and I was hoping for some help.
    I need to render the cells in my table differently (alignment, colors, etc) depending on the row AND the column, not just the column. I've got this working just fine, except for changing the cell's horizontal alignment won't work.
    I have a CustomCellRenderer that extends DefaultTableCellRenderer and overrides the getTableCellRendererComponent() method, setting the foreground/background colors and horizontal alignment of the cell based on the cell's value.
    I have a CustomTable that extends JTable and overrides the getCellRenderer(int row, int column) method to return a private instance of this CustomCellRenderer.
    This works fine for foreground/background colors, but my calls to setHorizontalAlignment() in the getTableCellRendererComponent() seem to have no effect, every cell is always displayed LEFT aligned! It's almost like the cell's alignment is determined by something else than the table.getCellRenderer(row,column).getTableCellRendererComponent() method.
    I've also tried setting the renderer for every existing TableColumn in the TableModel to this custom renderer, as well as overriding the table's getDefaultColumn() method to return this custom renderer as well for any Class parameter, with no success.
    No matter what I've tried, I can customize the cell however I want, EXCEPT for the horizontal alignment!!!
    Any ideas???
    Here's the core custom classes that I'm using:
    class CustomTable extends JTable {
    private CustomRenderer customRenderer = new CustomRenderer();
    public CustomTable() {
    super();
    public TableCellRenderer getCellRenderer(int row, int column) {
    return customRenderer;
    } // end class CustomTable
    class CustomRenderer extends DefaultTableCellRenderer {
    public CustomRenderer() {
    super();
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    if (row % 2 == 0) {
    setForeground(Color.red);
    setHorizontalAlignment(RIGHT);
    } else {
    setForeground(Color.blue);
    setHorizontalAlignment(LEFT);
    return this;
    } // end class CustomRenderer
    Even worse, I've gotten this to work fine in a trivial example I made to try and re-create the problem. But for some reason, this same thing is just not working for horizontal alignment in my actual project?!?
    Anyone have any ideas how the cell's horizontal alignment set in the getTableCellRendererComponent() method is being ignored or overwritten before the cell is being displayed???
    Thanks, any help is appreciated,
    -Alex Blume

    Ok, so I've looked into their source and I think I know where and what the trouble is. The JTable.java has a method called:
    3658> public TableCellRenderer getCellRenderer(int row, int column) {
    3659> TableColumn tableColumn = getColumnModel().getColumn(column);
    3660> TableCellRenderer renderer = tableColumn.getCellRenderer();
    3661> if (renderer == null) {
    3662> renderer = getDefaultRenderer(getColumnClass(column));
    3663> }
    3664> return renderer;
    3665> }
    starting at line 3658 of their source code. It retrieves the TableCellRenderer on line 3660 by calling the tableColumn's getCellRenderer method. This is found in the TableColumn.java class:
    421> public TableCellRenderer getCellRenderer() {
    422> return cellRenderer;
    423> }
    See the problem? Only ONE cell Renderer. It's referring to a variable found at line 140 which is of type TableCellRenderer ... well actually it's created as a DefaultTableCellRenderer at some point since TableCellRenderer is an interface.
    Basically the fix is this:
    In the TableColumn.java file, a collection (Vector, LinkedList, whatever) needs to keep track of each cell's renderer. This will solve the solution. Of course this will be something that you or I can make.
    What's funny is the contradiction in documentation between JTable's and TableColumn's getCellRenderer() method. First, if we look at TableColumn's documentation it states:
    "Returns the TableCellRenderer used by the JTable to draw values for this column."
    Based on that first statement, the getCellRenderer() method in TableColumn is doing its job exactly. No lies, no contradictions in what it does.
    However, that method is called up inside of the JTable's getCellRenderer() method which says a completely different thing which is:
    "Returns an appropriate renderer for the cell specified by this row and column."
    Now we have a problem. For the cell specified. It appears that the rush to push this out blinded some developer who either:
    1) mis-interpreted what the JTable getCellRenderer() method was supposed to do and inadvertently added a feature or;
    2) was in a 2 a.m. blitz, wired on Pepsi and adrenalin and wrote the bug in.
    Either way, I'm really hoping that they'll fix this because it will take care of at least 2 bugs. Btw, anyone interested in posting a subclass to solve this problem (subclass of TableColumn) is more than welcome. I've spent much too much time on this and my project is already behind so I can't really afford any more time on this.
    later,
    a.

  • How to pass a struct to a DLL function and accessing it in another VI

    Hi friends,
                       I am new to labview. I need to create a demo program in labview ,for displaying image from our own image capturing system. We have a  DLL ( build in VC++) containing functions for capturing image from our system. Now I need to create a VI library for some of functions in DLL and Create a Demo program using those created subvi library . I used "Call Function node" and created some of subvi's.
     Some of our DLL functions need to pass struct pointers.  Our function prototype will be similar to the following function.
    __declspec(dllexport) int __stdcall Initialize( unsigned char *imagebuffer,struct config *Configuration);
    The passed struct is similar to
    struct config
      double                val1[3];
      unsigned short   val2;
      bool                    val3;
      bool                    val4[3];    
      unsigned char    val5;    
      unsigned char   val6[3];
      bool                    val7[26];
    For passing "unsigned char *imagebuffer"  I initialized array with "Numeric constant " and set the size of the array and send to the function.
    The problem here is, I used this array in one of the subvi. 
    How can I use the returned imagebuffer array  in my main demo program. How to connect the image array to subvi "Connecter Pane"
    And  which control  can I use to display the image. The image data I get is form of 1-D Array .
    The second problem is,
                                 For passing the structure,  I used "Bundle " and filled the bundle with all the datatypes as in my struct and passed to the function. Is it correct ?  How to access this bundle after returned from function  in another Vi. ie.) How to connect this bundle to the connter pane ?
    Thanks for your valuable suggestions.
    aajjf.
    Message Edited by aajjf on 04-19-2007 05:34 AM

    aajjf wrote:
    Hi friends,
                       I am new to labview. I need to create a demo program in labview ,for displaying image from our own image capturing system. We have a  DLL ( build in VC++) containing functions for capturing image from our system. Now I need to create a VI library for some of functions in DLL and Create a Demo program using those created subvi library . I used "Call Function node" and created some of subvi's.
     Some of our DLL functions need to pass struct pointers.  Our function prototype will be similar to the following function.
    __declspec(dllexport) int __stdcall Initialize( unsigned char *imagebuffer,struct config *Configuration);
    The passed struct is similar to
    struct config
      double                val1[3];
      unsigned short   val2;
      bool                    val3;
      bool                    val4[3];    
      unsigned char    val5;    
      unsigned char   val6[3];
      bool                    val7[26];
    For passing "unsigned char *imagebuffer"  I initialized array with "Numeric constant " and set the size of the array and send to the function.
    The problem here is, I used this array in one of the subvi. 
    How can I use the returned imagebuffer array  in my main demo program. How to connect the image array to subvi "Connecter Pane"
    And  which control  can I use to display the image. The image data I get is form of 1-D Array .
    The second problem is,
                                 For passing the structure,  I used "Bundle " and filled the bundle with all the datatypes as in my struct and passed to the function. Is it correct ?  How to access this bundle after returned from function  in another Vi. ie.) How to connect this bundle to the connter pane ?
    Thanks for your valuable suggestions.
    aajjf.
    Message Edited by aajjf on 04-19-2007 05:34 AM
    You say nothing about how your cluster looks but I'm afraid you did the standard error here and placed arrays in it. That is not what the C structure is representing for several reasons.
    First fixed size arrays in C are inlined inside a structure, so are not a pointer but for the case of your val1 element three doubles.
    Second although not relevant here because of above point: LabVIEW arrays are not the same as C arrays. LabVIEW uses a pointer to a pointer and has the size of the array in elements prepended to the array data. C simply uses a pointer and all the rest is the programmers sorrow. The Call Library Node does convert the top level element of variables you pass according to the type configuration of that parameter but does no conversion of internal elements at all. So passing clusters with anything like arrays or strings is always wrong unless the DLL is aware of the specific datatypes LabVIEW uses.
    Last but not least you can end up with alignment issues. Elements in structures are aligned by every C compiler to a certain value. This value can be defined by the programmer in the project settings or for Visual C through #pragma pack() statements in the C code. The alignment rule says that an variable is aligned to the smaller of the two values that are either a multiple of the variable element size or the alignment setting. Most 32bit code nowadays uses 8 bit default alignment but LabVIEW always uses 1 byte. In your case there is nothing to observe since the large variables are at the beginning. Otherwise you might have had to insert filler elements in the LabVIEW cluster.
    One last thing bool is a C++ type only. Its size is 1 byte and incidentially this is the same LabVIEW uses for Booleans.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

Maybe you are looking for

  • Find total no of pages in a sap script

    Hi,   How do i find the no of pages that is generated in SAP script, with out generating a spool. thanks.

  • IE script error rendering DataSet.  JSP

    IE console catches the error as:       SCRIPT600: Unknown runtime error      SpryData.js, line 1269 character 4 The dataset is to be displayed in a table.  IE displays the table, but instead of data, it displays each <td> as {dataSetName::columnName}

  • How do I create a transparent watermark for video from a white background logo in AI CC?

    If I have a .PNG logo with a white background, how do I create a transparent watermark to use in video and photo content using Illustrator CC? Whenever I import the logo, it opens a new window without a transparent background. Thank you!

  • Firefox won't open, and doesn't show up in the task manager.

    I have clicked on all the icons available, but none will open the browser. I do not get an error message. It does not show up on th task manager. I have restarted my computer several times but no result.

  • Serious bug in Flex Builder 3

    I just lost a whole morning's work. Here's what I did: I needed to base a new component on an existing one. So, in the FB3 file list I right-click, copy file, paste file, rename to new name. Open up the new file and do my work on it. I saved the file