472,353 Members | 1,414 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

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 1553
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
by: Fabian Müller | last post by:
Hi all, my question is as follows: If have a class X and a class Y derived from X. Constructor of X is X(param1, param2) . Constructor of...
35
by: hasho | last post by:
Why is "call by address" faster than "call by value"?
13
by: Bern McCarty | last post by:
I have run an experiment to try to learn some things about floating point performance in managed C++. I am using Visual Studio 2003. I was hoping...
4
by: John | last post by:
Hi all, This really is quite an urgent matter. I have a page with multiple, dynamically-loaded user controls and when a user clicks on a...
5
by: Amaryllis | last post by:
I'm trying to call a CL which is located on our AS400 from a Windows application. I've tried to code it in different ways, but I seem to get the...
13
by: mitchellpal | last post by:
i am really having a hard time trying to differentiate the two..........i mean.....anyone got a better idea how each occurs?
13
by: shsingh | last post by:
I have a class A containing some map as data variables. I creat an object of class A on heap by allocatiing memory by using "malloc". This will...
3
by: cberthu | last post by:
Hi all, Is it possible to have two connects in the same rexx script to different DB's? I have to get data form on DB (with specifics selects and...
9
by: CryptiqueGuy | last post by:
Consider the variadic function with the following prototype: int foo(int num,...); Here 'num' specifies the number of arguments, and assume that...
12
by: Rahul | last post by:
Hi Everyone, I have the following code and i'm able to invoke the destructor explicitly but not the constructor. and i get a compile time error...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.