I was provided with a DLL ("InfoLookup.dll") that internally selects structures and returns pointers to them from the search function. Structures contain pointers to strings:
extern "C"
{
struct Info
{
int id;
char* szName;
};
Info* LookupInfo( int id );
}
In C #, how can I declare a structure structure, declare an Interop call, and (assuming a non-zero value is returned) use a string value? In other words, how do I translate the following into C #:
#include "InfoLookup.h"
void foo()
{
Info* info = LookupInfo( 0 );
if( info != 0 && info->szName != 0 )
DoSomethingWith( info->szName );
}
source
share