Calling unmanaged code in C#

Oct 1 2003 7:15 AM
I have to call a dll fucntion of unmanaged code which uses a callback fucntion and returns a pointer to a structure to that callback fucntion The dll function is int PBORCA_LibraryDirectory ( HPBORCA hORCASession, LPSTR lpszLibName, LPSTR lpszLibComments, int iCmntsBuffSize, PBORCA_LISTPROC pListProc, LPVOID pUserData ); the structure which the above fucntion passes to its callback fucntion is as follows typedef struct pborca_direntry { CHAR szComments[PBORCA_MAXCOMMENT + 1]; LONG lCreateTime; LONG lEntrySize; LPSTR lpszEntryName; PBORCA_TYPE otEntryType;} PBORCA_DIRENTRY, FAR *PPBORCA_DIRENTRY; In my managed code, I've replaced the above structure by a class and used a delegate to call the callback function I've imported the dll through DllImport attribute But when I'm attempting to read out the values of the structure fields in my managed code callback fucntion, it's giving me an error "Identifier out of scope" for the structure fields. I've also used [Out] attribute for that structure. Please let me know the apt solution for retrieving values of parameters passed by an unmanaged fucntion to it's callback fucntions. I need a solution urgently.Please send me a reply at the earliest. Also,if my information(query) isn't clear, then please mail me. I'll provide detailed information