473,395 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

marshal complex structures to native 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 C dll (eVC 4.0) 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?

I need to do it on VB.NET for Compact Framework

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 22 '05 #1
0 962

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Philippe C. Martin | last post by:
Hi, I am looking into using the pickle format to store object/complex data structures into a smart card as it would make the design of the embedded application very simple. Yet the card...
0
by: Ivan | last post by:
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...
0
by: Andre | last post by:
Hi, I have a problem with marshaling nested structures struct a { struct b s_b; struct d s_d;
2
by: twawsico | last post by:
I have a piece of code that needs to read the contents of a binary file (that I've created with another app) into an array of structures. The binary data in the file represents just a series of...
0
by: Ivan | last post by:
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...
21
by: Mike | last post by:
Hi, The example below shows that result of a marshaled data structure is nothing but a string >>> data = {2:'two', 3:'three'} >>> import marshal >>> bytes = marshal.dumps(data) >>>...
2
by: RYoung | last post by:
Given this native struct: typedef struct vendor { char name; } VENDOR I want to make managed equivalent, so I did this: public value struct Vendor
7
by: repekto.argosoft | last post by:
Hi, I'm working with Marshalling. I got an idea to pass an object to the Native side as a byte array i.e. as void* in terms of C. For example: I have a .NET structure Point that contains...
4
by: cleanrabbit | last post by:
Hello! I hate having to do this, because im almost certain there is someone in the world that has come across this problem and i just havent found their solution yet, so i do appologise if this...
2
by: O.B. | last post by:
When using Marshal to copy data from a byte array to the structure below, only the first byte of the "other" array is getting copied from the original byte array. What do I need to specify to get...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.