473,503 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to ? out argument in managed c++

Hello gurus,

I have the following C# function signature:
void TheFunction(Dictionary<string, MyClassObjdicName, out int nOne, out
int nTwo, out int nThree, out int nFour);

And it works fine.

I'm trying to write a managed C++ function that will save the save
signature, but till now I've got all kind of compiler error.

Can anyone tell me how a managed C++ function signature should look like
that will do the job like the one I showed above?
--
Thanks
Sharon
Jun 21 '07 #1
6 1635

void __gc* TheFunction(Dictionary<String __gc*, MyClassObj __gc*__gc*
dicName, [Out] Int32 __gc* *nOne, [Out] Int32 __gc* *nTwo, [Out] Int32 __gc*
*nThree, [Out] Int32 __gc* *nFour);

this was obtained using Reflector (http://www.aisto.com/roeder/dotnet/).
It may not be the shortest signature (all the __gc). However, it should work

- José

"Sharon" <Sh*****@newsgroups.nospama écrit dans le message de news:
91**********************************@microsoft.com...
Hello gurus,

I have the following C# function signature:
void TheFunction(Dictionary<string, MyClassObjdicName, out int nOne, out
int nTwo, out int nThree, out int nFour);

And it works fine.

I'm trying to write a managed C++ function that will save the save
signature, but till now I've got all kind of compiler error.

Can anyone tell me how a managed C++ function signature should look like
that will do the job like the one I showed above?
--
Thanks
Sharon

Jun 21 '07 #2
The term 'managed C++' is kind of ambiguous, since many people use that same
term to refer to both Managed C++ (VC 2003) and C++/CLI.
If you want it in C++/CLI, it's:
void TheFunction(Dictionary<System::String^, MyClassObj^^dicName,
[System::Runtime::InteropServices::Out] int %nOne,
[System::Runtime::InteropServices::Out] int %nTwo,
[System::Runtime::InteropServices::Out] int %nThree,
[System::Runtime::InteropServices::Out] int %nFour)

--
David Anton
www.tangiblesoftwaresolutions.com
Convert between VB, C#, C++, and Python
Instant C#
Instant VB
Instant C++
Instant Python
C++ to C# Converter
C++ to VB Converter
"Sharon" wrote:
Hello gurus,

I have the following C# function signature:
void TheFunction(Dictionary<string, MyClassObjdicName, out int nOne, out
int nTwo, out int nThree, out int nFour);

And it works fine.

I'm trying to write a managed C++ function that will save the save
signature, but till now I've got all kind of compiler error.

Can anyone tell me how a managed C++ function signature should look like
that will do the job like the one I showed above?
--
Thanks
Sharon
Jun 22 '07 #3
Thanks José,

I think the function is for .NET Framework 1.1, but I'm using the Framework 2.
Sorry for not pointing that our earlier.

Could you please post it for Framework 2?
--
Thanks
Sharon
Jun 22 '07 #4
Thanks David,

I 'm using the Framework 2 (VS2005). Sorry for not pointing that our earlier.

Your solution works fine.

---------
Thanks a lot
Sharon
Jun 22 '07 #5
Hi David,

The function signature still works but I have strange problem checking if
the dicName is null or not...

In the function (VC++ 2005 (C++/CLI)):

void TheFunction( System::Collections::Generic::Dictionary<System::S tring^,
MyClassObj^>^ dicName, [System::RuntimeServices::Interop::Out] int% nOne,
[System::RuntimeServices::Interop::Out] int% nTwo,
[System::RuntimeServices::Interop::Out] int% nThree,
[System::RuntimeServices::Interop::Out] int% nFour)
{
if( dicName != NULL ) // Error
{
if( dicName ["key"] != NULL ) // Error
{
...
}
...
}
}

I tried some other ways to check it, but I'm still getting all kind of
compiler error.

How do I check if it's null or not if the above two cases?
--
Thanks
Sharon
Jun 23 '07 #6
"Sharon" <Sh*****@newsgroups.nospamwrote in message
news:AF**********************************@microsof t.com...
Hi David,

The function signature still works but I have strange problem checking if
the dicName is null or not...

In the function (VC++ 2005 (C++/CLI)):

void TheFunction(
System::Collections::Generic::Dictionary<System::S tring^,
MyClassObj^>^ dicName, [System::RuntimeServices::Interop::Out] int% nOne,
[System::RuntimeServices::Interop::Out] int% nTwo,
[System::RuntimeServices::Interop::Out] int% nThree,
[System::RuntimeServices::Interop::Out] int% nFour)
{
if( dicName != NULL ) // Error
{
if( dicName ["key"] != NULL ) // Error
{
...
}
...
}
}

I tried some other ways to check it, but I'm still getting all kind of
compiler error.

How do I check if it's null or not if the above two cases?
--
Thanks
Sharon

if( dicName != nullptr)

I would suggest you to start reading the C++/CLI language specifications, it
will save you a lot of time waiting for an answer to your questions in a NG
;-)

Willy.

Jun 23 '07 #7

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

Similar topics

2
1722
by: mrambil | last post by:
Hi, I'm using PHP 4.3.3 in CLI on Win XP SP1. I use the _experimental_ w32api. It seems to work quite fine yet I cannot pass a string argument to any of my dll functions : 1) Load the w32api...
64
3316
by: Morgan Cheng | last post by:
Hi All, I was taught that argument valuse is not supposed to be changed in function body. Say, below code is not good. void foo1(int x) { x ++; printf("x+1 = %d\n", x); } It should be...
11
1927
by: j23 | last post by:
I have library (static) testlib.cpp: #include <stdarg.h> void xxx(...) { char buf; va_list args; va_start(args, buf); va_end(args); }
2
1317
by: Chris | last post by:
Hi, how can I use variable argument lists in C++.NET (cfr 'params' in C#) ? thnx Chris
5
1556
by: kchui | last post by:
I have a C# interface as: public interface IBar{ void TestParam(ref StringCollection a, ref int b); } And I need to implment it in Managed C++, and I try to implement it as: public __gc...
5
3074
by: nass | last post by:
this is a thought experiment. i do not have the time to implement it and test it to see if it works so i am relying on your good will:) thank you in advance im on a linux machine (slackware...
3
4328
by: vijay.gandhi | last post by:
Hi, I am trying to convert a set of classes written in VC++ 6.0 to a .DLL file using VC++ .NET (Visual Studio 2005) and C++/CLI. I made one of the classes (one at the root level) to be a 'ref'...
4
3679
by: =?Utf-8?B?U2hhcm9u?= | last post by:
Hello gurus, I have the following C# function signature: void TheFunction(Dictionary<string, MyClassObjdicName, out int nOne, out int nTwo, out int nThree, out int nFour); And it works fine....
23
3243
by: nikki2 | last post by:
Hi I have a database, with which I have always had problems. Sometimes they were Invalid Argument problems, and sometimes there were others (such as that the record was too large). Some of the...
0
7083
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7328
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6988
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7456
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3166
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
734
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
379
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.