473,624 Members | 2,005 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(Dic tionary<string, MyClassObjdicNa me, 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 1641

void __gc* TheFunction(Dic tionary<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*****@newsgr oups.nospama écrit dans le message de news:
91************* *************** **...icrosof t.com...
Hello gurus,

I have the following C# function signature:
void TheFunction(Dic tionary<string, MyClassObjdicNa me, 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(Dic tionary<System: :String^, MyClassObj^^dic Name,
[System::Runtime ::InteropServic es::Out] int %nOne,
[System::Runtime ::InteropServic es::Out] int %nTwo,
[System::Runtime ::InteropServic es::Out] int %nThree,
[System::Runtime ::InteropServic es::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(Dic tionary<string, MyClassObjdicNa me, 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::Collect ions::Generic:: Dictionary<Syst em::String^,
MyClassObj^>^ dicName, [System::Runtime Services::Inter op::Out] int% nOne,
[System::Runtime Services::Inter op::Out] int% nTwo,
[System::Runtime Services::Inter op::Out] int% nThree,
[System::Runtime Services::Inter op::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*****@newsgr oups.nospamwrot e in message
news:AF******** *************** ***********@mic rosoft.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::Collect ions::Generic:: Dictionary<Syst em::String^,
MyClassObj^>^ dicName, [System::Runtime Services::Inter op::Out] int% nOne,
[System::Runtime Services::Inter op::Out] int% nTwo,
[System::Runtime Services::Inter op::Out] int% nThree,
[System::Runtime Services::Inter op::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
1731
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 extension : if (!dl("php_w32api.dll")) { echo "Erreur : Impossible de chager le module php_w32api (php_w32api.dll)."; exit;
64
3363
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 "refactor-ed" to be
11
1959
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
1325
by: Chris | last post by:
Hi, how can I use variable argument lists in C++.NET (cfr 'params' in C#) ? thnx Chris
5
1560
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 class Foo : public IBar { public:
5
3081
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 10.2) on an i686 intell processor. its my first attempt to convert a fileIO procedure, to a pthread so it won't stall the execution of the code. im going through an online tutorial
3
4334
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' class. This class used pointer to a function. Since CLR does not support a ref class to have a pointer to a function directly, I changed it to a 'delegate'.
4
3687
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. 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.
23
3253
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 tables are very large and only linked in, some are imported. The ODBC is a pervasive odbc engine interface. In the past, some of the problems have gone away by compacting and repairing the database. Still, it's difficult to keep working with this...
0
8236
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8173
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8621
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8335
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8475
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7159
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4079
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2606
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1785
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.