-
February 29th, 2012, 11:29 PM
#1
Byte array problem
Hi guys, i have a one byte array in c++ with /cli and return the next error:
error C2526: 'System::Collections::Generic::IList<T>:efault::get' : linking the C function can not return the class 'System::ArraySegment<T>' of C++
This is my code
Code:
array<System::Byte>^ buffer = gcnew array<System::Byte>(1500);
try
{
server->Receive(buffer);
}
catch ( SocketException^ e )
{
Console::WriteLine( "{0} Error code: {1}.", e->Message, e->ErrorCode.ToString() );
return ( e->ErrorCode );
}
-
February 29th, 2012, 11:30 PM
#2
Re: Byte array problem
Sorry by the double post.
the error its in the line
Code:
server->Receive(buffer);
-
February 29th, 2012, 11:33 PM
#3
Re: Byte array problem
sorry for the 3° post, this is in the top code
Code:
#using <System.dll>
#using <mscorlib.dll>
using namespace System;
using namespace System::Text;
using namespace System::IO;
using namespace System::Net;
using namespace System::Net::Sockets;
I have clr enabled
SORRY FOR MY BAD ENGLISH
-
March 1st, 2012, 09:19 AM
#4
Re: Byte array problem
Looks like you translated back the error message from a non-English version of VC++. The MSDN page on the error message at http://msdn.microsoft.com/en-us/library/y59181c6.aspx doesn't quite tell me much more than that, but the original message is a bit more informative:
'identifier1' : C linkage function cannot return C++ class 'identifier2'
And though that is not the exact original meaning, in the context here the message probably means in essence that a native function can't return a managed type. This is speculation to some extent, though, since the code you posted doesn't really tell the whole story. Is, by any chance, perhaps server->Receive() a native function or is any other native function involved? Since the error message mentions C linkage, the function in question may not be a member of a class at all (or it may be static), and perhaps it's just unmanaged by mistake.
I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.
This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|