some help with interop

V

Vadym Stetsyak

Hi there!!!

I've got the following code and during compilation I have
this error:

fatal error C1093: API call 'DefineCustomAttribute'
failed '0x801311d0'

What can this mean?


StructLayout(LayoutKind::Sequential,
CharSet=CharSet::Auto)]
__gc struct uReference
{
[MarshalAs(UnmanagedType::Bool)]
bool Added;
System::UInt64 m_object_id;
System::UInt64 object_id;
};

[StructLayout(LayoutKind::Sequential,
CharSet=CharSet::Auto)]
__gc struct uContextProperty
{
[MarshalAs(UnmanagedType::Bool)]
bool wasChanged;
[MarshalAs(UnmanagedType::ByValTStr)]
System::String* pszKey;

int nContains;
int nProperty;
float dProperty;
[MarshalAs(UnmanagedType::ByValTStr)]
System::String *pszProperty;
uReference *prefernce;
};


[StructLayout(LayoutKind::Sequential,
CharSet=CharSet::Auto)]
__gc struct uContext
{
[MarshalAs(UnmanagedType::Bool)]
bool m_canBePersistent;
[MarshalAs(UnmanagedType::Bool)]
bool finished;
[MarshalAs(UnmanagedType::Bool)]
bool m_mustCallMakePersistant;

[MarshalAs(UnmanagedType::LPArray)]
uReference[] m_Coll;

[Marshal(UnmanagedType::LPArray)]
uReference[] m_DellColl;

[Marshal(UnmanagedType::LPArray)]
uReference[] m_OldColl;

[MarshalAs(UnmanagedType::ByValTStr)]
System::String szClassName;

System::UInt64 id_clas
s;
System::UInt64 id_object;
};
 
M

Mattias Sjögren

Vadym,

For UnmanagedType::ByValTStr, you must set the string length in the
MarshalAsAttribute::SizeConst field.



Mattias
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top