dot.net com class function

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • gs

    #1

    dot.net com class function

    what is the proper interop description for result of string array for an
    function that is to be called through com interface by legacy application?

    I tried
    Public Function etstor0(<Out()> ByRef iCnt As Integer, _
    <Out()> <MarshalAs(Unma nagedType.LPArr ay,
    ArraySubType:=U nmanagedType.LP Str, SizeParamIndex: =0)> ByRef
    strMatchReslts( ) As String _
    ) As Integer

    ----
    end Function

    I was calling something like this from a legacy application

    // establish, initialize the com class object: myComclass
    string sresult[]
    long ll_cnt, ll_rc

    ll_rc = myComclass.esto r(Ref ll_cnt, Ref sresult)


    but I got a message saying
    Error calling external object function etstor0


    I have established that in this legacy application, long is the vb integer,
    and plan old string without array is ok with calling this .net com class
    function that do not involve arrays.


  • Dragon

    #2
    Re: dot.net com class function

    Does your function change the array as a whole (I mean, something like
    strMatchResults = New String(){...})? If it doesn't, then you maybe have
    to declare strMatchResults ByVal, not ByRef.

    Roman

    "gs" <gs@nomail.ni l> ñîîáùèë/ñîîáùèëà â íîâîñòÿõ ñëåäóþùåå:
    news:#b7fCVUdGH A.4224@TK2MSFTN GP04.phx.gbl...[color=blue]
    > what is the proper interop description for result of string array for[/color]
    an[color=blue]
    > function that is to be called through com interface by legacy[/color]
    application?[color=blue]
    >
    > I tried
    > Public Function etstor0(<Out()> ByRef iCnt As Integer, _
    > <Out()> <MarshalAs(Unma nagedType.LPArr ay,
    > ArraySubType:=U nmanagedType.LP Str, SizeParamIndex: =0)> ByRef
    > strMatchReslts( ) As String _
    > ) As Integer
    >
    > ----
    > end Function
    >
    > I was calling something like this from a legacy application
    >
    > // establish, initialize the com class object: myComclass
    > string sresult[]
    > long ll_cnt, ll_rc
    >
    > ll_rc = myComclass.esto r(Ref ll_cnt, Ref sresult)
    >
    >
    > but I got a message saying
    > Error calling external object function etstor0
    >
    >
    > I have established that in this legacy application, long is the vb[/color]
    integer,[color=blue]
    > and plan old string without array is ok with calling this .net com[/color]
    class[color=blue]
    > function that do not involve arrays.
    >
    >[/color]


    Comment

    • gs

      #3
      Re: dot.net com class function

      the function does change the array with match results from regex operations
      "Dragon" <no@spam.please > wrote in message
      news:%230RqC9cd GHA.3632@TK2MSF TNGP02.phx.gbl. ..[color=blue]
      > Does your function change the array as a whole (I mean, something like
      > strMatchResults = New String(){...})? If it doesn't, then you maybe have
      > to declare strMatchResults ByVal, not ByRef.
      >
      > Roman
      >
      > "gs" <gs@nomail.ni l> ñîîáùèë/ñîîáùèëà â íîâîñòÿõ ñëåäóþùåå:
      > news:#b7fCVUdGH A.4224@TK2MSFTN GP04.phx.gbl...[color=green]
      >> what is the proper interop description for result of string array for[/color]
      > an[color=green]
      >> function that is to be called through com interface by legacy[/color]
      > application?[color=green]
      >>
      >> I tried
      >> Public Function etstor0(<Out()> ByRef iCnt As Integer, _
      >> <Out()> <MarshalAs(Unma nagedType.LPArr ay,
      >> ArraySubType:=U nmanagedType.LP Str, SizeParamIndex: =0)> ByRef
      >> strMatchReslts( ) As String _
      >> ) As Integer
      >>
      >> ----
      >> end Function
      >>
      >> I was calling something like this from a legacy application
      >>
      >> // establish, initialize the com class object: myComclass
      >> string sresult[]
      >> long ll_cnt, ll_rc
      >>
      >> ll_rc = myComclass.esto r(Ref ll_cnt, Ref sresult)
      >>
      >>
      >> but I got a message saying
      >> Error calling external object function etstor0
      >>
      >>
      >> I have established that in this legacy application, long is the vb[/color]
      > integer,[color=green]
      >> and plan old string without array is ok with calling this .net com[/color]
      > class[color=green]
      >> function that do not involve arrays.
      >>
      >>[/color]
      >
      >[/color]


      Comment

      Working...