c# com call

  • Thread starter Thread starter rasa
  • Start date Start date
R

rasa

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.
 
Hi,

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

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

But i can not guarantee it will work...

Regards

Marcin
 
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 = 0;
}

fixed (short* dest = array)
{
myobj.SomeFunction(19, 1, ref *dest);
}
 
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
--------------------
Content-Class: urn:content-classes:message
From: "rasa" <[email protected]>
Sender: "rasa" <[email protected]>
References: <[email protected]>
Subject: c# com call-- am I getting warm here?
Date: Tue, 26 Aug 2003 10:01:22 -0700
Lines: 24
Message-ID: <[email protected]>
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: AcNr861r19e4QVcMTayq+c/Dsj98Lw==
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Newsgroups: microsoft.public.dotnet.languages.csharp
Path: cpmsftngxa06.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:179562
NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
X-Tomcat-NG: microsoft.public.dotnet.languages.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 = 0;
}

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

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



--

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.
 
Back
Top