469,642 Members | 1,243 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,642 developers. It's quick & easy.

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.
Nov 15 '05 #1
3 1459
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

rasa wrote:
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.


Nov 15 '05 #2
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.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.
.

Nov 15 '05 #3
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" <ra***********@yaskawa.com>
Sender: "rasa" <ra***********@yaskawa.com>
References: <05****************************@phx.gbl>
Subject: c# com call-- am I getting warm here?
Date: Tue, 26 Aug 2003 10:01:22 -0700
Lines: 24
Message-ID: <00****************************@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: 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[i] = 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.

Nov 15 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

23 posts views Thread by Fabian Müller | last post: by
35 posts views Thread by hasho | last post: by
13 posts views Thread by mitchellpal | last post: by
3 posts views Thread by cberthu | last post: by
9 posts views Thread by CryptiqueGuy | last post: by
12 posts views Thread by Rahul | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.