RE: VS2005 : Managed Wrapper for Unmanaged code : Ellipsis dilema
- From: David Anton <DavidAnton@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 17 Oct 2007 15:51:01 -0700
Why not use a C++/CLI parameter array?
e.g.,
void test(... array<System::Object^> ^ParamArray)
--
http://www.tangiblesoftwaresolutions.com
C++ to C#
C++ to VB
C++ to Java
C++ to C++/CLI
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: convert VB or C# to C++/CLI
"Olivier Matrot" wrote:
Hello,.
I'm in the process of writing a managed wrapper on legacy C++ code.
I have to deal with methods that are using the ellipsis.
For instance,the legacy method is :
void CLog::Print (LPCSTR szMask, ...)
{
CHAR szText[512];
va_list arglist;
va_start (arglist, szMask);
wvsprintfA (szText, szMask, arglist);
va_end (arglist);
}
The wrapper looks like this :
void Print(System::String ^ Text, array<Object^>^ args )
{
CStringA s((LPCTSTR)UnmanagedString(Text));
m_pLog->Print(s, args);
}
I'm calling the wrapper with this call :
log->Print("Hello, CallCount is [%d]", gcnew
array<Object^>(1){(System::Int32)1});
And the result is "Hello CallCount [3226976]" instead of "Hello CallCount
[1]"
Where is the problem ?
TIA.
- Follow-Ups:
- Re: VS2005 : Managed Wrapper for Unmanaged code : Ellipsis dilema
- From: Olivier Matrot
- Re: VS2005 : Managed Wrapper for Unmanaged code : Ellipsis dilema
- References:
- VS2005 : Managed Wrapper for Unmanaged code : Ellipsis dilema
- From: Olivier Matrot
- VS2005 : Managed Wrapper for Unmanaged code : Ellipsis dilema
- Prev by Date: Re: Windows 2003 Server vs Windows XP
- Next by Date: Re: Building a Unicode application.
- Previous by thread: Re: VS2005 : Managed Wrapper for Unmanaged code : Ellipsis dilema
- Next by thread: Re: VS2005 : Managed Wrapper for Unmanaged code : Ellipsis dilema
- Index(es):
Relevant Pages
|