By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,825 Members | 1,149 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,825 IT Pros & Developers. It's quick & easy.

marshal complex structure to C dll

P: n/a
Hi All,

I have a problem with marshaling complex structures (containing numbers,
strings, arrays of another structures) to native C function in dll.
I have already posted same question to .compactframework thread, but nobody
helped.

main problem is that I have tried all the workarounds I have found in the
Inet but nothing worked...
I tried passing IntPtr, Byte Arrays, Serialisation, even used OpenNETCF, but
all failed.

I have even compiled own dll with same structures and functions, and there I
can see what is passed in params and can return needed values. Result - the
structure I pass to the function is empty and the structure I return from
the function is not retrieved to outside (I have same structure that passed
to function with no changes)

any ideas?

thanks in advance for any help.
Ivan.

--------------------

typedef struct tagACROSS_CLUE {
unsigned int numClue; /* Clue number */
LPCWSTR strClue; /* The clue - clue number not included in the string */
} ACROSS_CLUE;

typedef struct tagACROSS_EXTDATA {
unsigned char extDataSignature[4]; /* Four byte character signature */
unsigned int dataSize; /* Size of extended data in bytes */
char * extData; /* uninterpreted bytes of data */
} ACROSS_EXTDATA;

typedef struct tagACROSS_HEADER {
BYTE bytes[44]; /* Uninterpreted bytes from the header */
} ACROSS_HEADER;

typedef struct tagACROSS_PUZZLE_DATA {
unsigned int struct_size; /* size of the data structure passed in bytes
must be initialized */
unsigned int szAcross; /* Grid size - No. of cells across */
unsigned int szDown; /* Grid Size - No. of cells down */
unsigned int numAClues; /* Total No. of Across clues */
unsigned int numDClues; /* Total No. of Down clues */
int flagsDescr; /* Puzzle flags */
int numCodeSet; /* Character code set used for the puzzle */
unsigned int numPtrSolnKey; /* For saving, if solution is to be locked,
the 4 digit lock key is returned here For reading, this is not used */
LPCWSTR strTitle; /* Puzzle Title */
LPCWSTR strAuthor; /* Puzzle Author */
LPCWSTR strCopyright; /* Puzzle Copyright */
LPCWSTR charsGrid; /* Puzzle Grid with solution */
LPCWSTR strNote; /* Puzzle notepad entry. Max length 1023 characters */
ACROSS_CLUE * cluesAcross;/* Pointer to array of Across clues */
ACROSS_CLUE * cluesDown; /* Pointer to array of Down clues */
unsigned int numExtData; /* Number of extended data structures */
ACROSS_EXTDATA * extDataList; /* Pointer to array of extended data
structures */
} ACROSS_PUZZLE_DATA;

ACLIB_API int ACROSS_InputPuzzle(LPCWSTR filename,

ACROSS_PUZZLE_DATA * puzzleDescriptor);

/* filename - Complete path name of file to read puzzle from */

/* puzzleDescriptor - Pointer to structure that will contain puzzle
data. */
Nov 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.