Array issues in VC and Delphi and compatibility issues between DLL and Delphi written by VC Delphi/Windows SDK/API
Http://www.delphi2007.net/DelphiBase/html/delphi_20061210224541205.html
Question 1: Do the two-dimensional char * array in VC have the same structure as the two-dimensional pchar array in Delphi?
Question 2: Can C ++ have a dynamic 2-dimensional char * array?
Question 3: I remember that DLL does not seem to be able to create its own memory space. If I pass a struct pointer and then let the DLL create multiple structs to connect?
The struct is as follows:
Type Tx = packed record
Data: pointer;
Nextx: pointer;
End;
In short, I want to use the DLL written by VC to return a two-dimensional char * array to the primary node written by Delphi. Program And then release it successfully. If you cannot answer the above questions, you can give me some advice on how to implement this.
I hope to score points by noon tomorrow...
Nobody?
Don't use Char. You can use XML as the parameter, and it has nothing to do with the language.
Question 1: Do the two-dimensional char * array in VC have the same structure as the two-dimensional pchar array in Delphi?
~ _~ : The two-dimensional array can be changed to one-dimensional... for example:
Char chararr_2 [2] [3] = {0 };
Char chararr_1 [6] = {0 };
Question 2: Can C ++ have a dynamic 2-dimensional char * array?
You can dynamically allocate memory... or use the above method to try.
Char * Parr = (char *) realoc (N * sizeof (char); // n: Number of array elements
Question 3: I remember that DLL does not seem to be able to create its own memory space. If I pass a struct pointer and then let the DLL create multiple structs to connect?
Make global variables in DLL .....
For reference only...
-_-!!, Syntax error. Correct .....
Char * Parr = (char *) malloc (N * sizeof (char ));
Parr = (char *) realloc (Parr, N_2 * sizeof (char); // N_2: Number of new array elements
Agree upstairs
To yi10000 ()
XML? I don't think it is necessary?
To dinglinger (red chilies)
I think it is troublesome to call one-dimensional arrays... the previous DLL is used to export one-dimensional arrays. I want to convert one-dimensional arrays into two-dimensional arrays and then pass them to Delphi...
Do not use pchar, use byte
To lextm (Lele)
What does it mean? For example
I wrote something last night.CodeWe found that the arrangement of elements in multi-dimensional arrays of VC and Delphi is different...
I wonder if different C ++ compilers are the same