<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Reading a Borland structed File in LabVIEW</title>
    <link>https://ni.lithium.com/t5/LabVIEW/Reading-a-Borland-structed-File/m-p/2512#M1908</link>
    <description>I am trying to throw together a quick program with LabView which needs to&lt;BR /&gt;read files that have been written by a Borland compiled program.&lt;BR /&gt;It seems Borland does not handle structs the same as LabView, Borland seems&lt;BR /&gt;to condense the memory allocated to a structure.  If something only needs&lt;BR /&gt;16bits only 16bits are allocated.  At least this is what the programmers&lt;BR /&gt;around here are telling me.&lt;BR /&gt;I found a way around this by reading each element of the structure one by&lt;BR /&gt;one, but I was told there should be a easier way around this.  It seems Visual&lt;BR /&gt;C++ has the same problem as LabView when reading Borland structures.  Visual&lt;BR /&gt;C++ has a command  that changes the structures to match Borland.&lt;BR /&gt;Does LabView have this capability? &lt;BR /&gt;</description>
    <pubDate>Tue, 23 Nov 1999 22:09:05 GMT</pubDate>
    <dc:creator>Kenneth Leung</dc:creator>
    <dc:date>1999-11-23T22:09:05Z</dc:date>
    <item>
      <title>Reading a Borland structed File</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Reading-a-Borland-structed-File/m-p/2512#M1908</link>
      <description>I am trying to throw together a quick program with LabView which needs to&lt;BR /&gt;read files that have been written by a Borland compiled program.&lt;BR /&gt;It seems Borland does not handle structs the same as LabView, Borland seems&lt;BR /&gt;to condense the memory allocated to a structure.  If something only needs&lt;BR /&gt;16bits only 16bits are allocated.  At least this is what the programmers&lt;BR /&gt;around here are telling me.&lt;BR /&gt;I found a way around this by reading each element of the structure one by&lt;BR /&gt;one, but I was told there should be a easier way around this.  It seems Visual&lt;BR /&gt;C++ has the same problem as LabView when reading Borland structures.  Visual&lt;BR /&gt;C++ has a command  that changes the structures to match Borland.&lt;BR /&gt;Does LabView have this capability? &lt;BR /&gt;</description>
      <pubDate>Tue, 23 Nov 1999 22:09:05 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Reading-a-Borland-structed-File/m-p/2512#M1908</guid>
      <dc:creator>Kenneth Leung</dc:creator>
      <dc:date>1999-11-23T22:09:05Z</dc:date>
    </item>
    <item>
      <title>Re: Reading a Borland structed File</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Reading-a-Borland-structed-File/m-p/2513#M1909</link>
      <description>&amp;gt; I am trying to throw together a quick program with LabView which needs to&lt;BR /&gt;&amp;gt; read files that have been written by a Borland compiled program.&lt;BR /&gt;&amp;gt; It seems Borland does not handle structs the same as LabView, Borland seems&lt;BR /&gt;&amp;gt; to condense the memory allocated to a structure.  If something only needs&lt;BR /&gt;&amp;gt; 16bits only 16bits are allocated.  At least this is what the programmers&lt;BR /&gt;&amp;gt; around here are telling me.&lt;BR /&gt;&amp;gt; I found a way around this by reading each element of the structure one by&lt;BR /&gt;&amp;gt; one, but I was told there should be a easier way around this.  It seems Visual&lt;BR /&gt;&amp;gt; C++ has the same problem as LabView when reading Borland structures.  Visual&lt;BR /&gt;&amp;gt; C++ has a command  that changes the structures to match Borland.&lt;BR /&gt;&amp;gt; Does LabView have this capability?&lt;BR /&gt;&lt;BR /&gt;There are several issues here -- promotion, alignment, and endianness.&lt;BR /&gt;&lt;BR /&gt;Most compilers will allocate the space specified with a typical&lt;BR /&gt;limit of a one byte minimum.  Some choose to promote small allocation&lt;BR /&gt;to a larger size.  This happens on PCs when passing parameters to a&lt;BR /&gt;function, and some exotic computers do this to structs as well.  This&lt;BR /&gt;is generally done for speed of access.  LV always allocates the size&lt;BR /&gt;requested, one byte, two, four, eight for doubles, or ten for extendeds&lt;BR /&gt;(Note that extendeds are a different size on each platform's memory&lt;BR /&gt;representation and sixteen bytes on disk).&lt;BR /&gt;&lt;BR /&gt;Alignment refers the initial address where an allocation will be located&lt;BR /&gt;and the additional space added between allocations.  Typical alignment&lt;BR /&gt;rules are that bytes can be stored at any address, but two-byte words&lt;BR /&gt;are stored on even addresses, four-byte longs are stored on mod-four&lt;BR /&gt;addresses, and perhaps there is an eight byte rule.  The alignment rules&lt;BR /&gt;are very much dependent on the chip architecture, and again its a&lt;BR /&gt;performance issue.  CPUs can be simplified if they can make assumptions&lt;BR /&gt;about which addresses the instructions need to load from, and they&lt;BR /&gt;often use exception/interrupt based means for loading non-aligned memory.&lt;BR /&gt;&lt;BR /&gt;The Intel architecture has no required alignment rules and can access&lt;BR /&gt;any size allocation from any address.  Compilers settings can change&lt;BR /&gt;the alignment to be more strict than necessary, and that is becoming&lt;BR /&gt;more common on the PC.  LV still locates allocations on a one-byte&lt;BR /&gt;boundary, meaning that there is never any additional space inserted&lt;BR /&gt;between cluster/structure elements.&lt;BR /&gt;&lt;BR /&gt;Endianness refers to the order of bytes in a multi-byte allocation.  Intel&lt;BR /&gt;is referred to as a little-endian architecture and SPARC, PA-RISC, PPC,&lt;BR /&gt;68K, and most others are typically used big-endian.  Some architectures can&lt;BR /&gt;actually switch depending on what the OS requires.  The in-memory image of&lt;BR /&gt;any allocation in LV is the native format, but when saved to disk, the data&lt;BR /&gt;is always standardized -- meaning it is always saved in big-endian format.&lt;BR /&gt;This was chosen as the standard partly because of where LV came from, and&lt;BR /&gt;partly because this is considered the network standard.  Saving data in&lt;BR /&gt;the standard form makes it easier to transport LV VIs and data between&lt;BR /&gt;platforms and read the data into a different type of computer, but it&lt;BR /&gt;does mean that other PC programs have a little difficulty reading and&lt;BR /&gt;writing to LV's data format.&lt;BR /&gt;&lt;BR /&gt;My guess here is that there is no problem with promotion or alignment,&lt;BR /&gt;but the problem is with the endianness.  I think it is the advanced&lt;BR /&gt;palette that has some memory access primitives that can be used to&lt;BR /&gt;swap bytes or words of an allocation to make them be match the assumptions&lt;BR /&gt;of the other PC application.  Note that there are only two types of&lt;BR /&gt;endianness, big and little.  Data files written by other applications&lt;BR /&gt;either match LV or they don't.  The same swap works on reads as well&lt;BR /&gt;as writes.&lt;BR /&gt;&lt;BR /&gt;Greg McKaskle&lt;BR /&gt;</description>
      <pubDate>Wed, 24 Nov 1999 15:28:20 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Reading-a-Borland-structed-File/m-p/2513#M1909</guid>
      <dc:creator>Greg_McKaskle2</dc:creator>
      <dc:date>1999-11-24T15:28:20Z</dc:date>
    </item>
  </channel>
</rss>

