473,326 Members | 2,815 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

HOWTO: use ArgIterator

Hello, All!

I haven't found any example of using ArgIterator and RuntimeArgumentHandle in MSDN. Are they analogous to elipsis (...) in C++? Can I call DLL exported function with elipsis using ArgIterator?

Regards,
Vladimir.

Winamp 5.0 (playing): Stratovarius - 4th Reich
Nov 15 '05 #1
3 6550
Vladimir,
I haven't found any example of using ArgIterator and RuntimeArgumentHandle in MSDN. Are they analogous to elipsis (...) in C++?
Here's an example

static void Varargs(__arglist)
{
ArgIterator args = new ArgIterator( __arglist );

int argCount = args.GetRemainingCount();
for ( int i = 0; i < argCount; i++ )
Console.WriteLine( TypedReference.ToObject( args.GetNextArg() ) );
}

static void Main()
{
Varargs( __arglist( 123, 456.78, "abc" ) );
}

Can I call DLL exported function with elipsis using ArgIterator?


You only need ArgIterator if you want to implement a varargs method.
For calling one you only need __arglist. __arglist, BTW, is
undocumented so there's no guarantee that it'll work in future
versions or other C# compilers. For pure managed work I'd strongly
recommend using params instead.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 15 '05 #2
Mattias Sjögren wrote:
[...]
static void Varargs(__arglist)
[...]


<shudder>
Nov 15 '05 #3
Hello, Mattias!
You wrote on Fri, 05 Mar 2004 20:35:40 +0100:

>> I haven't found any example of using ArgIterator and
>> RuntimeArgumentHandle in MSDN. Are they analogous to elipsis
>> (...) in C++?


MS> Here's an example
MS> static void Varargs(__arglist)
MS> Varargs( __arglist( 123, 456.78, "abc" ) );

And what about RuntimeArgumentHandle?

Another question. If I have some exported function in DLL defined like this

_declspec(dllexport) void DummyFn(char *sz1, char sz2, ...)
{
va_list marker;
vs_start(marker, sz2);
<do_some_stuff>;
va_end(marker);
}

how can I call it from C#? I've tried __arglist and params. It doesn't work. It seems PInvoke doesn't support such calls. And IJW too.

Regards,
Vladimir.

Winamp 5.0 (playing): Stratovarius - Twilight Time
Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Logan | last post by:
Several people asked me for the following HOWTO, so I decided to post it here (though it is still very 'alpha' and might contain many (?) mistakes; didn't test what I wrote, but wrote it - more or...
4
by: Josef Sachs | last post by:
Is Andrew Kuchling's regex-to-re HOWTO available anywhere? I've found the following (dead) links on various Web pages: http://py-howto.sourceforge.net/regex-to-re/regex-to-re.html...
3
by: Vladimir | last post by:
Hello, All! I haven't found any example of using ArgIterator and RuntimeArgumentHandle in MSDN. Are they analogous to elipsis (...) in C++? Can I call DLL exported function with elipsis using...
5
by: alejandro lapeyre | last post by:
How can I load / parse an HTML file with .NET? Thanks! Best regards, Alejandro Lapeyre
4
by: Ray Dukes | last post by:
What I am looking to do is map the implementation of interface properties and functions to an inherited method of the base class. Please see below. ...
0
by: Mark Harrison | last post by:
HOWTO: Integrating Posgresql queries into an event loop. Mark Harrison mh@pixar.com May 27, 2004 Problem ------- The commonly used postgresql APIs will block until completed.
8
by: Topper | last post by:
Hello. I have simple web folders structure: -ROOT - BIN WebService.dll WebService.asmx I need to use my WebService.dll not in bin folder - for example, in ROOT. How do i this? How can i do...
0
by: Andrew Dalke | last post by:
Years ago I wrote the Sorting mini-howto, currently at http://www.amk.ca/python/howto/sorting/sorting.html I've had various people thank me for that, in person and through email. It's...
4
by: Marco Meoni | last post by:
Hi. I read the Gordon McMillan's "Socket Programming Howto". I tried to use the example in this howto but this doesn't work. The code is class mysocket: '''classe solamente dimostrativa -...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.