G
Guest
I m trying to create a C++ managed class to use it in C#. I m new to MC++ and
interoperability and I try to find a bug since a long time without succes,
maybe you can help me ?
(I have a sample project if you want to debug it, you can contact me at
(e-mail address removed) too)
I describe the problem:
I have 2 MS VC2003 projects... they contains the same set of classes. I have
difference between both projetc, the first one is a MC++ project I have
create (C++ project that use the /clr flag to have a Managed DLL for .NET),
the second is the original C++ library (that works fine!)
1 - Here is my managed class :
----------------------------------------------
public __gc class UFOzSocket
{
private:
addrinfo _hints;
public:
UFOzSocket(AddressFamily addressFamily, SocketType socketType);
~UFOzSocket();
void Connect(EndPoint * remoteEP);
protected:
UFOzSocket();
private:
UDTSOCKET _internalSocket;
};
During debugging, when I see this structure, it is like this :
Structure in the first application, see by the debugger (BAD fields order):
-----------------------------------------------------------------------------
- _hints : addrinfo
+ ai_addr : 0x00000000 sockaddr*
+ ai_addrlen : 0 unsigned __int32
+ ai_canonname : 0x00000000 char*
+ ai_family :2 __int32
+ ai_flags :1 __int32
+ ai_next : 0x00000000 addrinfo*
+ ai_protocol : 0 __int32
+ ai_socktype : 1 __int32
Structure in the second application, see by the debugger (GOOD fields order):
----------------------------------------------------------------------------------
- hints {ai_flags=1 ai_family=2 ai_socktype=1 ...} addrinfo
+ ai_flags : 1 int
+ ai_family : 2 int
+ ai_socktype : 1 int
+ ai_protocol : 0 int
+ ai_addrlen : 0 unsigned int
+ ai_canonname : 0x00000000 <Bad Ptr> char *
+ ai_addr : 0x00000000 {sa_family=??? sa_data=0x00000002 <Bad
Ptr> } sockaddr *
+ ai_next : 0x00000000 {ai_flags=??? ai_family=???
ai_socktype=??? ...} addrinfo *
So, how can I change this to force the first application to have the same
behavior ?
When I debug the second program (original one) all is fine. My solution
crash due to the fact that the structure is not good !
Thanks for your help
Chris
interoperability and I try to find a bug since a long time without succes,
maybe you can help me ?
(I have a sample project if you want to debug it, you can contact me at
(e-mail address removed) too)
I describe the problem:
I have 2 MS VC2003 projects... they contains the same set of classes. I have
difference between both projetc, the first one is a MC++ project I have
create (C++ project that use the /clr flag to have a Managed DLL for .NET),
the second is the original C++ library (that works fine!)
1 - Here is my managed class :
----------------------------------------------
public __gc class UFOzSocket
{
private:
addrinfo _hints;
public:
UFOzSocket(AddressFamily addressFamily, SocketType socketType);
~UFOzSocket();
void Connect(EndPoint * remoteEP);
protected:
UFOzSocket();
private:
UDTSOCKET _internalSocket;
};
During debugging, when I see this structure, it is like this :
Structure in the first application, see by the debugger (BAD fields order):
-----------------------------------------------------------------------------
- _hints : addrinfo
+ ai_addr : 0x00000000 sockaddr*
+ ai_addrlen : 0 unsigned __int32
+ ai_canonname : 0x00000000 char*
+ ai_family :2 __int32
+ ai_flags :1 __int32
+ ai_next : 0x00000000 addrinfo*
+ ai_protocol : 0 __int32
+ ai_socktype : 1 __int32
Structure in the second application, see by the debugger (GOOD fields order):
----------------------------------------------------------------------------------
- hints {ai_flags=1 ai_family=2 ai_socktype=1 ...} addrinfo
+ ai_flags : 1 int
+ ai_family : 2 int
+ ai_socktype : 1 int
+ ai_protocol : 0 int
+ ai_addrlen : 0 unsigned int
+ ai_canonname : 0x00000000 <Bad Ptr> char *
+ ai_addr : 0x00000000 {sa_family=??? sa_data=0x00000002 <Bad
Ptr> } sockaddr *
+ ai_next : 0x00000000 {ai_flags=??? ai_family=???
ai_socktype=??? ...} addrinfo *
So, how can I change this to force the first application to have the same
behavior ?
When I debug the second program (original one) all is fine. My solution
crash due to the fact that the structure is not good !
Thanks for your help
Chris