Schnuffel Posted June 25, 2022 Share Posted June 25, 2022 hello @ all, i would like to Create a Struct with DllStructCreate an d an 2-dimensional Array in it. $tagZINT_SYMBOL = "struct;" & _ "int symbology;" & _ "int height;" & _ "int whitespace_width;" & _ "int border_width;" & _ "int output_options;" & _ "char fgcolour[10];" & _ "char bgcolour[10];" & _ "char outfile[256];" & _ "float scale;" & _ "int option_1;" & _ "int option_2;" & _ "int option_3;" & _ "int show_hrt;" & _ "int input_mode;" & _ "byte text[128];" & _ "int rows;" & _ "int width;" & _ "char primary[128];" & _ "int row_height[178][143];" & _ "char errtxt[100];" & _ "char bitmap;" & _ "int bitmap_width;" & _ "int bitmap_height;" & _ "endstruct" ;STRUCT ZINT_SYMBOL / PTR StructCreate $tZINT_SYMBOL = DllStructCreate($tagZINT_SYMBOL) ConsoleWrite("Error: " & @error & @CRLF) My problem is row "int row_height[178][143]". I found 1 Post in the hole forum discussing this point. The answer from "The Kandie Man" was: "You can't create multidimensional char arrays." --> Link to post I would like to ask Jos, if it is possible to do something like that. ^^ I attach the original zint.h with the struct reference in "C" the zint.dll and my code. It is a little bit wierd cause there are a few Struct that are referenced with ptr. This part is also not working till now. But one after the other. ^^ In the demo i deleted the ptr in $tagZINT_SYMBOL cause it drops an error too. here is the origin end of $tagZINT_SYMBOL "BYTE bitmap_height;" & _ "ptr* "& $ptrZINT_RENDER & " *rendered;" & _ ; this one is the second problem ^^ "endstruct" ;STRUCT ZINT_SYMBOL / PTR StructCreate" Spoiler expandcollapse popup#include <Array.au3> $tagZINT_RENDER_LINE = "struct;" & _ "float x;" & _ "float y;" & _ "float length;" & _ "float width;" & _ "ptr *next;" & _ "endstruct" ;STRUCT ZINT_RENDER_LINE / PTR StructCreate $tagZINT_RENDER_STRING = "struct;" & _ "float x;" & _ "float y;" & _ "int length;" & _ "char* text;" & _ "ptr *next;" & _ "endstruct" ;STRUCT ZINT_RENDER_STRING / PTR StructCreate $tagZINT_RENDER_RING = "struct;" & _ "float x;" & _ "float y;" & _ "float radius;" & _ "float line_width;" & _ "ptr *next;" & _ "endstruct" ;STRUCT ZINT_RENDER_RING / PTR StructCreate $tagZINT_RENDER_HEXAGON = "struct;" & _ "float x;" & _ "float y;" & _ "ptr *next;" & _ "endstruct" ;STRUCT ZINT_RENDER_HEXAGON / PTR StructCreate $tZINT_RENDER_LINE = DllStructCreate($tagZINT_RENDER_LINE) $tZINT_RENDER_STRING = DllStructCreate($tagZINT_RENDER_STRING) $tZINT_RENDER_RING = DllStructCreate($tagZINT_RENDER_RING) $tZINT_RENDER_HEXAGON = DllStructCreate($tagZINT_RENDER_HEXAGON) $ptrZINT_RENDER_LINE = DllStructGetPtr($tZINT_RENDER_LINE) $ptrZINT_RENDER_STRING = DllStructGetPtr($tZINT_RENDER_STRING) $ptrZINT_RENDER_RING = DllStructGetPtr($tZINT_RENDER_RING) $ptrZINT_RENDER_HEXAGON = DllStructGetPtr($tZINT_RENDER_HEXAGON) $tagZINT_RENDER = "struct;" & _ "float width;" & _ "float height;" & _ "ptr* " & $ptrZINT_RENDER_LINE & " *lines;" & _ "ptr* " & $ptrZINT_RENDER_STRING & " *strings;" & _ "ptr* " & $ptrZINT_RENDER_RING & " *rings;" & _ "ptr* " & $ptrZINT_RENDER_HEXAGON &" *hexagons;" & _ "endstruct";STRUCT ZINT_RENDER / PTR StructCreate $tZINT_RENDER = DllStructCreate($tagZINT_RENDER) $ptrZINT_RENDER = DllStructGetPtr($tagZINT_RENDER) $tagZINT_SYMBOL = "struct;" & _ "int symbology;" & _ "int height;" & _ "int whitespace_width;" & _ "int border_width;" & _ "int output_options;" & _ "char fgcolour[10];" & _ "char bgcolour[10];" & _ "char outfile[256];" & _ "float scale;" & _ "int option_1;" & _ "int option_2;" & _ "int option_3;" & _ "int show_hrt;" & _ "int input_mode;" & _ "char text[128];" & _ "int rows;" & _ "int width;" & _ "char primary[128];" & _ "byte encoded_data[178][143];" & _ "int row_height[178];" & _ "char errtxt[100];" & _ "char bitmap;" & _ "int bitmap_width;" & _ "BYTE bitmap_height;" & _ "endstruct" ;STRUCT ZINT_SYMBOL / PTR StructCreate $tZINT_SYMBOL = DllStructCreate($tagZINT_SYMBOL) ConsoleWrite("Error: " & @error & @CRLF) zint.h zint.dll manual.pdf The two basic principles of Windows system administration: For minor problems, reboot -- For major problems, reinstall "Sarkasm is the lowest form of humor, but the highest form of intelligenz" Val McDermid Link to comment Share on other sites More sharing options...
KaFu Posted June 25, 2022 Share Posted June 25, 2022 (edited) zint.h = 0 bytes https://github.com/samlown/zint/blob/master/backend/zint.h int row_height[178]; /* Largest symbol is 177x177 QR Code */ https://zint.org.uk/manual/chapter/5 row_height = array of integers Representation of the height of a row. (output only) I would think this means that row_height is an array of 178 elements, where each element ranges between 0 and 177 in value. Edit: The structure in the above linked zint.h file looks different than yours: unsigned char encoded_data[178][143]; int row_height[178]; /* Largest symbol is 177x177 QR Code * Googling unsigned char encoded_data leads to this: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/f29fbf40-094f-4ece-933d-4f161923ebfa/problem-using-a-struct-as-parameter-for-bidirectional-data-transfer-c-c-interop?forum=csharplanguage [MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.U1, SizeConst=25454)] So it seems like encoded_data might be represented by byte encoded_data[25454] Edited June 25, 2022 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now