Hi, I have an IPC library that is written in C++. I had created Managed C++ wrappers to provide .net access to the main classes but this approach has an undesired side affect. Because of the side affect I want to convert the entire library to C++.net. This is my first exposure to .net by the way.
I am having a problem with the following class.
The constructor with the bold code above is getting the compiler error.
c:\acssdktest\examples\ipc\ipcimpl.h(114) : error C2664: 'void aconnex_connectivity_services::IPCByteArray::setBytes(int,char __gc[],bool)' : cannot convert parameter 2 from 'char *const ' to 'char __gc[]'
Can only convert a __gc array to or from Object * or Array *
This IPCByteArray constructor takes an IPCByteArray as a parameter and tries to pass its mData data member to the setBytes() method. I tried making the mData a "char __gc * mData" but that caused other errors.
How do I make this conversion work?
Thanks for any help you can give me.
I am having a problem with the following class.
Code:
public __gc class IPCByteArray : public IPCArrayBase {
//friend class IPCUtil;
public:
IPCByteArray() : mData(NULL)
{ setBytes(IPC_NULL_VAL, NULL, true); }
IPCByteArray(int els) : mData(NULL)
{ setBytes(els, NULL, true); }
IPCByteArray(int els, char src __gc []) : mData(NULL)
{ setBytes(els, src, true); }
IPCByteArray(int els, char src __gc [], bool copysrc) : mData(NULL)
{ setBytes(els, src, copysrc); }
IPCByteArray(const IPCByteArray& src) : mData(NULL)
[b] { setBytes(src.mLen, src.mData, true); }[/b]
~IPCByteArray(void) { clear(); }
IPCObjectBase* copy(void) { return new IPCByteArray(const_cast<const IPCByteArray&>(*this)); }
void clear() { if (mLen > 0) delete[] mData;
mData=NULL; mLen=IPC_NULL_VAL; }
bool equals(const IPCObjectBase *val);
const short getType() { return ARY_TYPE; }
const int getTypeSize() { return TYPE_SZ; }
char* getBytes() { return mData; }
void setBytes() { setBytes(IPC_NULL_VAL,NULL,true); }
void setBytes(int els) { setBytes(els,NULL,true); }
void setBytes(int els, char src __gc []) { setBytes(els,src,true); }
void setBytes(int els, char src __gc [], bool copysrc);
protected:
[b]char* mData;[/b]
private:
static const short ARY_TYPE = IPC_TYPE_ARY_BYTE;
static const int TYPE_SZ = IPC_SZ_BYTE;
};
The constructor with the bold code above is getting the compiler error.
c:\acssdktest\examples\ipc\ipcimpl.h(114) : error C2664: 'void aconnex_connectivity_services::IPCByteArray::setBytes(int,char __gc[],bool)' : cannot convert parameter 2 from 'char *const ' to 'char __gc[]'
Can only convert a __gc array to or from Object * or Array *
This IPCByteArray constructor takes an IPCByteArray as a parameter and tries to pass its mData data member to the setBytes() method. I tried making the mData a "char __gc * mData" but that caused other errors.
How do I make this conversion work?
Thanks for any help you can give me.