Pointer to structure ActiveX Interface

Hi,
My Application is a ActiveX COM Server which exposes various methods. In one of the methods I need to pass a pointer to structure.
My develope env is Microsoft Visual C++ .NET 6
In the context of C programming, it would be something similar to this
typedef _MyStruct_s
    BOOL blFlag1;
    BOOL blFlag2;
}MyStruct_s;
BOOL MyAPI(MyStruct_s *pstMyStrcut)
    BOOL RetVal;
    RetVal = (pstMyStrcut->blFlag1 && pstMyStrcut->blFlag2);
    result RetVal;

Hi Brandon,
Looks like this limitation is from TestStand ActiveX adapter, and not from ActiveX/COM itself.
My application is an ActiveX/COM automation server. The same API (which is having issue through TestStand), does not have any issue if it is called from another UI based Standalone application.
(This Standalone application basically implements similar features with GUI by calling the exposed APIs of ActiveX/COM automation server)
Is any setting is missing (e.g. Custom Data Type etc) which is causing this problem?
I am aware that TestStand does not have any issue with passing a pointer to structure for C DLL.
Please let me know your inputs.
Setup:
TestStand 4.0
OS- WindowsXP
Thanks and Regards,
Subhash
Attachments:
NI_structure_Issue.JPG ‏41 KB

Similar Messages

  • Pointer of structure

    Can I get the pointer of a structure. e.g getting pointer of any integer etc maybe I need Marshal class.
    Allow time to reverse.

    With Marshal.StructureToPtr you can copy your structure to a memory block
    (see the VB example in the documentation) and then access the data via pointer represented as an
    IntPtr (for example, using Marshal.Copy). If you make some parts in C#, then you will be able to deal with pointers via
    unsafe and fixed, which are not available in VB.
    Thanks Viorel,
    I found my answer that I cannot get the pointer of a structure declared in .net environment. In order to deal with unmanaged structure I made this code:
    Imports System.Runtime.InteropServices
    Namespace Unmanaged
    Public Structure [Object](Of Struct As Structure)
    Implements IDisposable, ICloneable, IObject
    Private _Pointer As IntPtr
    ''' <summary>
    ''' Returns the pointer of structure
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public ReadOnly Property Pointer As IntPtr Implements IObject.Pointer
    Get
    Return _Pointer
    End Get
    End Property
    ''' <summary>
    ''' Returns the total size of object.
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public ReadOnly Property Size As Integer Implements IObject.Size
    Get
    Return Marshal.SizeOf(GetType(Struct))
    End Get
    End Property
    ''' <summary>
    ''' Return the type of structure.
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public ReadOnly Property Type As Type
    Get
    Return GetType(Struct)
    End Get
    End Property
    ''' <summary>
    ''' Accepts or returns the managed array of bytes.
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Property ManagedBytes As Byte()
    Get
    Dim bytes(Size - 1) As Byte
    Marshal.Copy(_Pointer, bytes, 0, Size)
    Return bytes
    End Get
    Set(value As Byte())
    Marshal.Copy(value, 0, _Pointer, Size)
    End Set
    End Property
    ''' <summary>
    ''' Returns the managed value of structure.
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Property Value As Struct
    Get
    Return Marshal.PtrToStructure(_Pointer, GetType(Struct))
    End Get
    Set(value As Struct)
    Marshal.StructureToPtr(value, _Pointer, True)
    End Set
    End Property
    ''' <summary>
    ''' Returns a copy of unmanaged object. Similar to Clone.
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function Copy() As [Object](Of Struct)
    Dim bytes(Size - 1) As Byte
    Marshal.Copy(_Pointer, bytes, 0, Size)
    Dim pointer = Marshal.AllocHGlobal(Size)
    Marshal.Copy(bytes, 0, pointer, Size)
    Erase bytes
    Return New [Object](Of Struct)(Intptr:=pointer)
    End Function
    ''' <summary>
    ''' Copy structure from current pointer to a specific pointer.
    ''' </summary>
    ''' <param name="Pointer"></param>
    ''' <remarks></remarks>
    Public Sub CopyTo(Pointer As IntPtr)
    Marshal.StructureToPtr(Value, Pointer, True)
    End Sub
    ''' <summary>
    ''' Copy structure from current pointer to a pointer of specific unmanaged object.
    ''' </summary>
    ''' <param name="Obj"></param>
    ''' <remarks></remarks>
    Public Sub CopyTo(Obj As [Object](Of Struct))
    Obj.Value = Me.Value
    End Sub
    ''' <summary>
    ''' Create new unmanaged object that has value of specific managed structure.
    ''' </summary>
    ''' <param name="Value"></param>
    ''' <remarks></remarks>
    Sub New(Value As Struct)
    _Pointer = Marshal.AllocHGlobal(Marshal.SizeOf(GetType(Struct)))
    Marshal.StructureToPtr(Value, _Pointer, True)
    End Sub
    ''' <summary>
    ''' Converts pointer of structure to unmanaged object.
    ''' </summary>
    ''' <param name="Intptr"></param>
    ''' <remarks></remarks>
    Sub New(Intptr As IntPtr)
    Me._Pointer = Intptr
    End Sub
    ''' <summary>
    ''' Creates an unmanaged object at specific pointer having specific value.
    ''' </summary>
    ''' <param name="Pointer"></param>
    ''' <param name="Value"></param>
    ''' <remarks></remarks>
    Sub New(Pointer As IntPtr, Value As Struct)
    _Pointer = Pointer
    Marshal.StructureToPtr(_Pointer, Pointer, True)
    End Sub
    Public Shared Narrowing Operator CType(Value As [Object](Of Struct)) As Struct
    Return Value.Value
    End Operator
    Public Shared Narrowing Operator CType(Value As Struct) As [Object](Of Struct)
    Return New [Object](Of Struct)(Value)
    End Operator
    Public Shared Narrowing Operator CType(Obj As [Object](Of Struct)) As IntPtr
    Return Obj.Pointer
    End Operator
    Public Shared Narrowing Operator CType(Pointer As IntPtr) As [Object](Of Struct)
    Return New [Object](Of Struct)(Intptr:=Pointer)
    End Operator
    ''' <summary>
    ''' Create a copy of unmanaged object.
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function Clone() As Object Implements ICloneable.Clone
    Return New [Object](Of Struct)(Me.Value)
    End Function
    ''' <summary>
    ''' Destroy unmanaged object.
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub Dispose() Implements IDisposable.Dispose
    Marshal.FreeHGlobal(_Pointer)
    _Pointer = Nothing
    End Sub
    End Structure
    Public Structure Array(Of Struct As Structure)
    Implements IDisposable, ICloneable, IObject, IEnumerable
    Private _Pointer As IntPtr
    Private Property _Count As Integer
    Get
    Return Marshal.ReadInt32(_Pointer)
    End Get
    Set(value As Integer)
    Marshal.WriteInt32(_Pointer, value)
    End Set
    End Property
    Public ReadOnly Property Count As Integer
    Get
    Return _Count
    End Get
    End Property
    Public ReadOnly Property Pointer As IntPtr Implements IObject.Pointer
    Get
    Return _Pointer
    End Get
    End Property
    Public ReadOnly Property Size As Integer Implements IObject.Size
    Get
    Return 4 + (Count * StructureSize)
    End Get
    End Property
    Public Property Value As Struct()
    Get
    Dim array(Count - 1) As Struct
    For i = 0 To Count - 1
    array(i) = Me(i)
    Next
    Return array
    End Get
    Set(value As Struct())
    For i = 0 To value.Count - 1
    Me(i) = value(i)
    Next
    End Set
    End Property
    Public ReadOnly Property StructureType As Type
    Get
    Return GetType(Struct)
    End Get
    End Property
    Public ReadOnly Property StructureSize As Integer
    Get
    Return Marshal.SizeOf(StructureType)
    End Get
    End Property
    Public ReadOnly Property ArrayPointer As IntPtr
    Get
    Return _Pointer + 4
    End Get
    End Property
    Public ReadOnly Property MemberPointer(ID As Integer) As IntPtr
    Get
    If ID >= Count Then Throw New System.IndexOutOfRangeException()
    Return _Pointer + 4 + (Size * ID)
    End Get
    End Property
    Public Property Member(ID As Integer) As [Object](Of Struct)
    Get
    Return New [Object](Of Struct)(Intptr:=MemberPointer(ID))
    End Get
    Set(value As [Object](Of Struct))
    Dim obj = Member(ID)
    obj.Value = value.Value
    End Set
    End Property
    Default Public Property ManagedMember(ID As Integer) As Struct
    Get
    Dim pointer = MemberPointer(ID)
    Return Marshal.PtrToStructure(pointer, GetType(Struct))
    End Get
    Set(value As Struct)
    Dim pointer = MemberPointer(ID)
    Marshal.StructureToPtr(value, pointer, True)
    End Set
    End Property
    Public Function Copy() As Array(Of Struct)
    Dim bytes(Size - 1) As Byte
    Marshal.Copy(_Pointer, bytes, 0, Size)
    Dim pointer = Marshal.AllocHGlobal(Size)
    Marshal.Copy(bytes, 0, pointer, Size)
    Erase bytes
    Return New Array(Of Struct)(Pointer:=pointer)
    End Function
    Sub New(Pointer As IntPtr)
    Me._Pointer = Pointer
    End Sub
    Sub New(Count As Integer)
    _Pointer = Marshal.AllocHGlobal(4 + (Count * Marshal.SizeOf(GetType(Struct))))
    Me._Count = Count
    End Sub
    Sub New(Array() As Struct)
    Me.New(Array.Count)
    Me.Value = Array
    End Sub
    Public Function Clone() As Object Implements ICloneable.Clone
    Return New Array(Of Struct)(Me.Value)
    End Function
    Public Sub Dispose() Implements IDisposable.Dispose
    Marshal.FreeHGlobal(_Pointer)
    _Pointer = 0
    End Sub
    Public Function GetEnumerator() As IEnumerator Implements IEnumerable.GetEnumerator
    Return New Enumerator(Me)
    End Function
    Private Structure Enumerator
    Implements IEnumerator
    Private _current As Integer
    Private _array As Array(Of Struct)
    Sub New(Array As Array(Of Struct))
    Me._array = Array
    _current = 0
    End Sub
    Public ReadOnly Property Current As Object Implements IEnumerator.Current
    Get
    Return _array(_current)
    End Get
    End Property
    Public Function MoveNext() As Boolean Implements IEnumerator.MoveNext
    _current = _current + 1
    Return (_current < _array.Count)
    End Function
    Public Sub Reset() Implements IEnumerator.Reset
    _current = 0
    End Sub
    End Structure
    End Structure
    Public Interface IObject
    ''' <summary>
    ''' Returns the pointer of structure
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    ReadOnly Property Pointer As IntPtr
    ''' <summary>
    ''' Returns the total size of object.
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    ReadOnly Property Size As Integer
    End Interface
    End Namespace
    I think I am doing right. Does my array matches the native array?
    Allow time to reverse.
    I would say NO!
    La vida loca

  • How do I quickly update the ActiveX automation references in my VIs when the ActiveX interface changes?

    Hello all,
    I joined a test automation team in the middle of a large project and
    inherited a huge set of VIs (over 700) and associated architecture for
    this automation (not to mention the several thousand TestStand
    sequences).  Another part of the project is being developed by our
    customer, who is using VB 6.0 to create ActiveX components which we
    need to use in LabView to access their hardware.  They've already
    invested a large amount of time developing these ActiveX components,
    and they are not finished -- meaning the ActiveX interfaces will be
    changing.  Every time they send updated ActiveX components, I have to
    re-write many, many VIs including updating a couple strict typdefs. 
    This process takes way too much time and is mind-numbing and prone to
    error or omission.
    Unfortunately I can't post any of the VIs because of a NDA.  But
    perhaps a bit more detailed explanation would help.  TestStand calls a
    VI to open and get an ActiveX reference for automation (which it stores
    in a variant).  It will pass this reference into any VI it calls to
    perform specific functions through this ActiveX interface.  For
    example, one VI that may be called passes this automation refnum into
    another, which passes it to another, which passes it into another to
    get the actual ActiveX reference stored in that variant (through a
    Variant To Data call with a strict typedef of the ActiveX component
    wired to the type input).  [See the attached image of this sample VI
    hierarchy: the far left icon would represent TestStand, and the far
    right is the strict typedef.]  Any of the VIs in the chain might use
    ActiveX Property or Invoke nodes, and it can break at any one of those
    when the ActiveX component changes.  It's easy to fix each one, but
    since there are so many VIs it takes a very long time.
    Is there any way at all to do a massive search/replace or something to
    make the ActiveX references update?  I realise that even though
    property or method names stay the same from one version to the next,
    they are different references.  Is there a way to update these based on
    name if you give it the base ActiveX reference?
    Thanks in advance for any help!
    Tom Williams
    Attachments:
    hierarchy.GIF ‏6 KB

    Ben,
    Unfortunately I can't post any VIs that would demonstrate the problem
    because the ActiveX components are confidential.  I'll try to develop
    my own ActiveX dll that will demonstrate it, but in the meantime, in
    hopes that another picture will help, I've attached an image of a block
    diagram (with some names changed to protect confidential information)
    of one of the lower level VIs from the hierarchy I posted.  In this
    example, the "Automation Refnum IN" is an input with a type definition
    linked to the strict typedef based on the ActiveX automation dll that
    has changed.  I updated that typedef, but as you can see the output to
    the "Class1" indicator is broken.  If I delete the "Class1" indicator
    and select Create->Indicator from the Class1 property node, and then
    wire the new "Class1" indicator to the connector pane, the VI is fixed
    -- at least at compile time.  In most cases there is also a runtime
    problem where the reference obtained by one of the intermediate
    property nodes is null, so the property or method node that uses it
    fails (e.g. "_VNManager.Networks" property returned is 0, so the
    "_Networks.Network1" property node fails).  To fix this problem, I have
    to delete the wires between the property nodes, and one by one select a
    different property/method, then select the correct property/method and
    re-wire.  There seems to be a bit of "jiggling the handle" to get it to
    work though.
    I don't know if the ActiveX developer changed anything in this class,
    but if he did, he didn't change the name of this class.  I would like
    to have to modify the VI only if a class, property or method has
    changed name or been removed.
    Does that all make sense?  Thanks for any pointers or help!
    Tom
    Attachments:
    Class1_Path.GIF ‏7 KB

  • How to get the entry point in the ActiveX/COM adaptor

    below is the description of the Demo of using the ActiveX/COM to call new seq . 
    API Demo
    1. Manually add a Message Popup step to the MainSequence of a
    new sequence file. Save the sequence file as launch.seq.
    2. Create another sequence file and save the file as caller.seq.
    3. In the MainSequence of the caller.seq file, add Action steps
    using the ActiveX/COM Adapter to call into the TestStand API and
    launch the launch.seq file in a new execution.You might need the
    following two methods to complete this step.
    . Engine.GetSequenceFileEx
    . Engine.NewExecution
    so the question as follows:
    1.i call the method of get sequencefileEx
    2. call the method of getmodlesequenceFile
    3.call the method of evalEntryPointNameExpression
    4.call the method of NewExecution.
    but at the step of 3. i haven't get the entry point.
    so how to solve this issue? thanks
    Attachments:
    QQ图片20140115200924.jpg ‏58 KB
    QQ图片20140115201708.jpg ‏100 KB

    This is a duplicate post of this:
    http://forums.ni.com/t5/NI-TestStand/How-to-get-the-entry-point-in-the-ActiveX-COM-adaptor/m-p/27005...

  • Using activex interfaces

    A method of my activex component say A1, requires a parameter of type LPDISPATCH (another activex interface, say A2). How to do that in a VI.
    A2 gets modified after calling method A1. How to use modified A2 later
    Are there any examples?

    You could wire an Automation refnum to that input terminal because that terminal would look to be of the same type or you will have to pass the A2 interface in from another method or property. LabVIEW can pass the returned LPDISPATCH as a variant from one activeX method to another.

  • Dynamic Structure in Interface and Forms

    Hallo experts,
    I am creating XML from the printreport. In print Report I am creating with RTTI a Structure and a Tabletype at runtime. Is it possible to give this type in Adobe Interface as type at runtime.
    The problem is that the XML looks like this.
    <PARVW>AG</PARVW>
      <KUNNR>0001000047</KUNNR>
    The costomer wants to show like this
    <PARVW_AG>AG</PARVW_AG>
      <KUNNR_AG>0001000047</KUNNR_AG>
    I have created a sturcture at runtime but I am not able to move it to form and interface.
    Can somebody help me in this issue.
    Thanks.
    Kind regards
    Waseem rana

    Hallo experts,
    I am creating XML from the printreport. In print Report I am creating with RTTI a Structure and a Tabletype at runtime. Is it possible to give this type in Adobe Interface as type at runtime.
    The problem is that the XML looks like this.
    <PARVW>AG</PARVW>
      <KUNNR>0001000047</KUNNR>
    The costomer wants to show like this
    <PARVW_AG>AG</PARVW_AG>
      <KUNNR_AG>0001000047</KUNNR_AG>
    I have created a sturcture at runtime but I am not able to move it to form and interface.
    Can somebody help me in this issue.
    Thanks.
    Kind regards
    Waseem rana

  • Pointer to structure, retrieve into a cluster

    I have a DLL that returns a pointer to an array of pointers.  Each pointer in this array points to a structure.  How do I access/display the contents of the structures in a cluster?

    So to simplify my request, I have a pointer to a structure, how can I view the data in the structure.
    the structure contains 
    char
    enum
    int
    double
    Here is my code so far
    Attachments:
    retrieve_struct_into_cluster.jpg ‏121 KB

  • Pointer to structure in parameter list of DLL

    I want to use the CALL_LIBRARY_FUNCTION to access a function in a DLL
    which returns a pointer to a structure in its parameter list. How can I
    access this structure under LabVIEW 6.02? What is the parameter type I
    have to select in the CALL_LIBRARY_FUNCTION configuration window - there
    is no STRUCTURE or CLUSTER entry?
    Any help is very much appreciated. Thanks, Frank

    You may select "Adapt to Type" as a type of the parameter of the function, and then connect appropriate cluster to the output of the "Call Library" node.
    Oleg Chutko.

  • Degree Audit Callup Point and Structure View of RC's (PIQRULEWB_AC)

    Hello,
    I have linked a rule container to an academic object (type SC, in this case), via callup point 60 (degree audit). When I am in the structure view looking at this, I notice that the popup text over the callup points icon says "Non-Academic Callup Pnt". I have read a VSR cookbook, and was under the impression that RC's linked to academic objects would have academic callup points. Am I looking at a bug (SAP GUI client 710; server 4.72), or do I have a misunderstanding about the degree audit callup point?
    Thanks,
      Eric

    Hi Eric,
    actually the use of Rule Containers and Callup-Points in Degree Audit is a bit different than how it is used for the academic processes. While you define particular rules like prerequisites using the VSR rule elements for callup points within activities like module booking or admission, in Degree Audit the rules in the rule containers are "collected" to build the audit profile for the student. Also the concept of academic and non-academic callup points does not really apply to the use callup points for audits.
    I would not necessarily consider it as a bug that the display shows the callup-point as "non-academic" - however it could be a bit confusing and I suggest that you sent a low priority OSS message such that our development can review whether they could make that a bit clearer to the end-user.
    Regards
    Joachim

  • SAP BAPI ActiveX Interface

    Hello,
    This is a cross post from LAVA forum...
    I'm trying to integrate our test stations to SAP ERP. SAP stores data in busines objects in busines object repository. The objects are exposed over BAPI interface. There is a lot of different busines objects in the repository. SAP developers can also build new objects if they want. The objective is to read inspection characeristics from quality management module of SAP. I haven't done much ActiveX stuff, neither know much about SAP, so I started with a simple example that I found searching for BAPI examples. The example works fine in Excel. The example just reads some data from a sales order object.
    Sub BAPI1()Dim
    oBook As Workbook
    Dim oSheet As Worksheet
    Dim oBAPICtrl As Object
    Dim oBAPILogon As Object
    Dim oSalesOrder As Object
    Dim oItem As Object
    Dim iIndex As Integer
    Set oBook = Application.ActiveWorkbook
    Set oSheet = oBook.Worksheets(1)
    ' Initialize SAP ActiveX Control.
    Set oBAPICtrl = CreateObject("sap.bapi.1")
    ' Initialize SAP ActiveX Logon.
    Set oBAPILogon = CreateObject("sap.logoncontrol.1")
    ' Initialize the connection object.
    Set oBAPICtrl.Connection = oBAPILogon.newconnection
    ' Logon with prompt.
    oBAPICtrl.Connection.System = "Q02"
    oBAPICtrl.Connection.Client = 101
    oBAPICtrl.Connection.Logon
    ' Retrieve a sales order.
    Set oSalesOrder = oBAPICtrl.GetSAPObject("SalesOrder","0010732181")
    ' Display Sales Order header data.
    oSheet.Cells(2, 1).Value = oSalesOrder.salesdocument
    oSheet.Cells(2, 2).Value = oSalesOrder.netvalue
    oSheet.Cells(2, 3).Value = oSalesOrder.orderingparty.customerno
    oSheet.Cells(2, 4).Value = oSalesOrder.documentdate
    oSheet.Cells(2, 5).Value = oSalesOrder.items.Count
    ' Logoff SAP and close the control.
    oBAPICtrl.Connection.logoff
    Set oBAPILogon = Nothing
    Set oBAPICtrl = Nothing
    End Sub
     I tried to implement that in LabVIEW. The logon and logout part works, I can also obtain SalesOrder object with GetSAPObject method. There is no error and probing the Object output from GetSAPObject methods gives an integer value - probably a reference to the SalesOrder object.
    Now I can't figure out how do I read the object properties. It's very simple in VBA. I also don't know how do I call object methods. This is apicture from SAP BAPI documentatios showing available properties and methods.
    I would appreciate any hints...
    bye, Mirko

    No, there isn't any reference type that matches BAPI Object. In fact, there can't be a fixed type reference, since BAPI object are actually function modules that SAP programmers write themselves using language called ABAP. I concluded that we can't call the object methods or read/write properties in LabVIEW, if we don't know the right type at development time. So, I gave up on BAPI API.
    There are also other methods of SAP integration. O step down on abstraction scale is Remote Function Call (RFC) API. The API is much more involved, but it allows us to call functions that are behind BAPI objects. In a few test that I did it worked fine. The interface is exposed over three ActiveX controls - SAP Remote Function Call Control, SAP Table Factory Control and SAP Logon Control.
    There is also .NET assembly and web services which I didn't tried.
    Regards, Mirko

  • Multiple WLANs pointing to same WLC interface

    I would like to have a guest Web auth based WLAN that points to an Interface that I also have configured for a separate 802.1X authentication that allows access to my private network.  I should note that I already have web auth configured for Guest access that only allows Internet access via separate WALN/VLAN.  This would allow me to setup access for a vendor that is on-site using the Lobby Ambassador .
    Is this possible and what do I need to do?   I have created the seperate WLAN with Web auth and pointed it to the same WLC interface that I use for the 802.1X and this does not seem to work.

    This has been resolved.  I found I had AP groups setup and had not added the WALN to the correct group.

  • Data element on structure for interface

    Hi all,
    I'm working on the development of one interface from a non-sap system to SAP where on a first step SAP will capture a flat file into one structure "ZZZ" but I'm doubting about how to create this structure.
    At first I was thinking on identifying a suitable component type/data element for each field (f.i. WAERS for currency field ZZZ-WAERS) but meanwhile I have noticed that for a similar interface the corresponding XXX structure was created using as data elements CHAR* type, where the * was the field length.
    Which criteria would you choose in my case? and what will it depend on?
    Thanks in advance.
    Abdali

    I think it is a good idea to use only CHAR-definitions for importing flat file data. Here the focus is to have a fixed column length and avoid conversion errors during import, as opposed to neat F1 help texts, for example.
    When further processing the data inside SAP you can move the data to another structure with proper data elements (like WAERS or WRBTR), checking for consistency and catching conversion errors in the process.
    Thomas

  • How to declare a pointer to structure element which is array structures

     LStr, *LStrPtr, **LStrHandle structure is taken from LabView cintools extcode.h
       I used: sprintf(((*(*in_array)->Strings[*count])->str), local_str); to pass local_str string to
    LabView array.  It worked fine, but  one programmer adviced me to change code to  be more readable.
    Means - to change  (*(*in_array)->Strings[*count]) construction to a pointer. I tried many different
    ways to implement this - but in all cases it caused LabView to crash. I understand that this question
    is related to C programming not about LabView, but could you point me at a place where I have mistake ?
    The most likely incorrect string is " LV_array = &(**((**in_array).Strings[*count])); "
    Thanks in advance.
    1.  typedef struct {
    2.        int32   cnt;            /* number of bytes that follow */
    3.        uChar   str[1];         /* cnt bytes */
    4.  } LStr, *LStrPtr, **LStrHandle;
    5.      
    6.  typedef struct {
    7.        int32 dimSize;
    8.        LStrHandle Strings[1];
    9.  } LVStringArray;
    10.      
    11. typedef LVStringArray **LVStrArrayHdl;
    12.      
    13  _declspec(dllexport) void avg_hello(int *count, LVStrArrayHdl in_array)
    14.      {
    15.      
    16.       unsigned char *local_str="Entering function ma_in()";
    17.       (*count) = 0;
    18.       LStr* LV_array;
    19.      
    20.       LV_array = &(**((**in_array).Strings[*count])); //Set address to which should point LV_array
    21.       subfunc(count, &in_array);                      // Call a function which resizes array (works)
    22.       sprintf(LV_array->str, local_str);              //passing string to LabView (not working)
    23.      
    24. }
    Solved!
    Go to Solution.

    thank you Andrey Dmitriev! spasibo!
    With your example I understood where I have error in my code:
    I tried to assign to pointer an address of string which wasn't yet pre-allocated!
    that means simply swapping strings we get final code:
    1.  typedef struct {
    2.        int32   cnt;            /* number of bytes that follow */
    3.        uChar   str[1];         /* cnt bytes */
    4.  } LStr, *LStrPtr, **LStrHandle;
    5.      
    6.  typedef struct {
    7.        int32 dimSize;
    8.        LStrHandle Strings[1];
    9.  } LVStringArray;
    10.      
    11. typedef LVStringArray **LVStrArrayHdl;
    12.      
    13  _declspec(dllexport) void avg_hello(int *count, LVStrArrayHdl in_array)
    14.      {
    15.      
    16.       unsigned char *local_str="Entering function ma_in()";
    17.       (*count) = 0;
    18.       LStr* LV_array;
    19.       subfunc(count, &in_array);                      // Call a function which resizes array (works), First we resize array, and only after that we can assign an address of string to a pointer
    20.       LV_array = &(**((**in_array).Strings[*count]));  //Assigning address to which should point LV_array
    21.      
    22.       sprintf(LV_array->str, local_str);              //passing string to LabView (not working)
    23.      
    24. }

  • Can we get the full command and syntax list for the DIAdem - Matlab ActiveX Interface?

    Hi,
    I am trying to utilize the DIAdem - Matlab Active X interface to open files for analysis in Matlab.  In order to do that, I need to pass a string from DIAdem to Matlab.  This does not work with the PutChannel function, since that only seems to work with doubles.  I noticed that ScriptLibrary.ocx contains many functions that are not described anywhere, such as 'PutCharArray'.  Any chance that we could have this list posted with the other info on this page:
    http://digital.ni.com/public.nsf/allkb/1706BA4C65A8533686256C630062DD03

    Hi Matt,
    This ScriptLibrary.ocx is not longer a supported approach for interfacing with MatLab.  The preferred method now is to directly use the functions exposed by MatLab's ActiveX server, along with the "ChnToVariant()" and "VariantToChn()" commands in DIAdem.  You can get an idea of this approach by reviewing the following example that ships with DIAdem:
    "Communicating with MATLAB"
    Unfortunately, this example does not show how to pass string values back and forth (though it would likely work to pass a string channel).  Whether this is possible will depend on the functions MatLab makes available in its ActiveX server to send or receive string scalars or vectors.
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments

  • Java null pointer exception in Executing interface

    I am using MS Access as source table. I am populating this data into oracle target table. when i execute the interface I get the following error in in the LKM.
    java.lang.NullPointerException
         at sun.jdbc.odbc.JdbcOdbcDriver.initialize(JdbcOdbcDriver.java:436)
         at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:153)
         at oracle.odi.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:409)
         at oracle.odi.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:385)
         at oracle.odi.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:352)
         at oracle.odi.jdbc.datasource.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:331)
         at oracle.odi.jdbc.datasource.LoginTimeoutDatasourceAdapter$ConnectionProcessor.run(LoginTimeoutDatasourceAdapter.java:217)
         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
         at java.util.concurrent.FutureTask.run(FutureTask.java:138)
         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
         at java.lang.Thread.run(Thread.java:662)
    I appreciate any help in how to resolve it..

    This error is in load table and the following the code
    SOURCE:
    select     
         MONTHLY_SUMMARY."Rec_ID"     as C1_REC_ID,
         MONTHLY_SUMMARY."Bill_Date"     as C2_BILL_DATE,
         MONTHLY_SUMMARY."Agency_Code"     as C3_AGENCY_CODE,
         MONTHLY_SUMMARY."User_Name"     as C4_USER_NAME,
         MONTHLY_SUMMARY."Phone_No"     as C5_PHONE_NO,
         MONTHLY_SUMMARY."Equipment"     as C6_EQUIPMENT,
         MONTHLY_SUMMARY."Total "     as C7_TOTAL,
         MONTHLY_SUMMARY."Rate "     as C8_RATE,
         MONTHLY_SUMMARY." Description"     as C9_ DESCRIPTION
    from     "Monthly_Summary " as MONTHLY_SUMMARY
    where     (1=1)
    TARGET
    insert /*+ append */ into ODI_DEV.C$_0SUMMARY_STAGING
         C1_REC_ID,
         C2_BILL_DATE,
         C3_AGENCY_CODE,
         C4_USER_NAME,
         C5_PHONE_NO,
         C6_ EQUIPMENT,
         C7_ TOTAL,
         C8_ RATE,
         C9_ DESCRIPTION
    values
         :C1_REC_ID,
         :C2_BILL_DATE,
         :C3_AGENCY_CODE,
         :C4_USER_NAME,
         :C5_PHONE_NO,
         :C6_ EQUIPMENT,
         :C7_ TOTAL,
         :C8_ RATE,
         :C9_ DESCRIPTION
    Thanks for the response

Maybe you are looking for

  • Windows 7 64 bit service pack 2 not sync with Itouch4g

    Windows 7 64 bit with new update of service pack 2 will not recognize ITouch4g 64 when connected or in Itunes 10.1.2 will not see the Itouch 4g 64 attached. Is there a new fix from apple and when will they send it out??

  • Is there any way to run signcode.exe program under background mode

    Hi everyone, I am finding the solutions to build the project automatically but the situation is still unchanged. When building the project i have use the signcode tool to sign my .cab files therefore the system shows me the "Enter Private Key Passwor

  • Download of webutil-DLLs fails

    Hi, according to DocId 252600.1 I've changed the line in webutil.cfg to install.syslib.location=http://localhost:8888/forms90/webutil Now there is no error message while downloading the DLLs but when I make a call to webutil my form hangs. Java Conso

  • I am having issues with my Macbook Pro after having synced my iPhone 5.

    It makes the trackpad act as a right click when tapping and the keyboard does not work properly. I found that by pressing the ctrl, alt and cmd keys together, or in combinations at the same time as pressing F1, it clears the problem for a while, then

  • Licensig for this product has stopped working

    Hi, I have set up a new Mac using Mac OS X 10.9.1 Mavericks and migrated my software to it using Migration Assistant. Most software is fine, but I cannot run Director 11.3. I am getting the following error: Licensing for this product has stopped work