c# com call

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

    #1

    c# com call


    I am able to instantiate and make calls to a com module
    that use only primitive data types, but I simply don't
    know what the c# equivalent is for a function expecting
    short*. Any help would be appreciated.
  • Marcin Grze;bski

    #2
    Re: c# com call

    Hi,

    Did you call this function as "DllImport" static function?
    If so then you can try e.g.:

    [DllImport(...)]
    public extern static void MyImportedMetho d(ref short myShort, ...);

    But i can not guarantee it will work...

    Regards

    Marcin

    rasa wrote:
    [color=blue]
    > I am able to instantiate and make calls to a com module
    > that use only primitive data types, but I simply don't
    > know what the c# equivalent is for a function expecting
    > short*. Any help would be appreciated.[/color]

    Comment

    • rasa

      #3
      c# com call-- am I getting warm here?

      I tried this, which compiles cleanly, but my app hangs
      when I try to run it:

      short[] array = new short[16];

      foreach ( int i in array )
      {
      array[i] = 0;
      }

      fixed (short* dest = array)
      {
      myobj.SomeFunct ion(19, 1, ref *dest);
      }

      [color=blue]
      >-----Original Message-----
      >
      >I am able to instantiate and make calls to a com module
      >that use only primitive data types, but I simply don't
      >know what the c# equivalent is for a function expecting
      >short*. Any help would be appreciated.
      >.
      >[/color]

      Comment

      • Eric

        #4
        RE: c# com call-- am I getting warm here?

        There is no equivalent in C#. You can get around this by using unmanaged
        code and having a point to a System.Int.32.. .
        Or you could change the params in your COM to a short (then you could just
        pass in a System.Int.32 w/o using unmanaged code).
        This would be more of a "how do I make calls to managed/unmanaged code from
        unmanaged/managed code?" question.

        Regards,

        Eric
        --------------------[color=blue]
        >Content-Class: urn:content-classes:message
        >From: "rasa" <rasa_isaacson@ yaskawa.com>
        >Sender: "rasa" <rasa_isaacson@ yaskawa.com>
        >References: <055b01c36bd4$a 6d21350$a001280 a@phx.gbl>
        >Subject: c# com call-- am I getting warm here?
        >Date: Tue, 26 Aug 2003 10:01:22 -0700
        >Lines: 24
        >Message-ID: <00bb01c36bf3$a d6e2e50$a401280 a@phx.gbl>
        >MIME-Version: 1.0
        >Content-Type: text/plain;
        > charset="iso-8859-1"
        >Content-Transfer-Encoding: 7bit
        >X-Newsreader: Microsoft CDO for Windows 2000
        >Thread-Index: AcNr861r19e4QVc MTayq+c/Dsj98Lw==
        >X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
        >Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
        >Path: cpmsftngxa06.ph x.gbl
        >Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1795 62
        >NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
        >X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
        >
        >I tried this, which compiles cleanly, but my app hangs
        >when I try to run it:
        >
        >short[] array = new short[16];
        >
        >foreach ( int i in array )
        >{
        > array[i] = 0;
        >}
        >
        >fixed (short* dest = array)
        >{
        > myobj.SomeFunct ion(19, 1, ref *dest);
        >}
        >
        >[color=green]
        >>-----Original Message-----
        >>
        >>I am able to instantiate and make calls to a com module
        >>that use only primitive data types, but I simply don't
        >>know what the c# equivalent is for a function expecting
        >>short*. Any help would be appreciated.
        >>.
        >>[/color]
        >[/color]


        --

        This posting is provided "AS IS" with no warranties, and confers no rights.
        Use of included script samples are subject to the terms specified at
        http://www.microsoft.com/info/cpyright.htm

        Note: For the benefit of the community-at-large, all responses to this
        message are best directed to the newsgroup/thread from which they
        originated.

        Comment

        Working...