471,044 Members | 948 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,044 software developers and data experts.

marshal complex structure to C dll

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
0 1501

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by spamacon | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.