473,725 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 .compactframewo rk 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_EXTDA TA {
unsigned char extDataSignatur e[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_HEADE R {
BYTE bytes[44]; /* Uninterpreted bytes from the header */
} ACROSS_HEADER;

typedef struct tagACROSS_PUZZL E_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_D ATA;

ACLIB_API int ACROSS_InputPuz zle(LPCWSTR filename,

ACROSS_PUZZLE_D ATA * puzzleDescripto r);

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

/* puzzleDescripto r - Pointer to structure that will contain puzzle
data. */

Jul 22 '05 #1
0 1504

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

Similar topics

0
987
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 might have to stay in the pocket of the customer for a few years, during which the back office application responsible for retrieving the information from the card might evolve as well as the
2
4859
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 singles that correspond to those in my structure detailed below. So when I load the file, all that I know for certain is that there will be some multiple of these eight singles represented in the binary data. My code below will read the data...
0
1640
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 .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
0
986
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 .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
21
2571
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) >>> type(bytes) <type 'str'>
2
3183
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
6489
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 two fields X and Y that means that the byte array representation will look in the memory like this: "XXXXYYYY" First four bytes are X and second for bytes are Y.
4
4726
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 has already been covered. I have been trying to learn c# as fast as possible in the last month and in doing so i have been re-visiting old C/C++ problems and trying to overcome them in C#. What i have is a very complex serise of structures. Id...
2
7205
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 Marshal.PtrToStructure to copy the all the data into the "other" array? unsafe public struct DeadReckoning {
0
8889
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9116
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8099
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3228
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.