nativesizeof is what I was looking for. Thanks, ~Paul On Sat, Jan 2, 2021 at 8:39 PM ToddAndMargo via perl6-users < perl6-users@perl.org> wrote: > On 1/2/21 4:58 PM, Paul Procacci wrote: > > Hey Gents, > > > > Hopefully a simple question that I could not find the answer to. > > > > Given the following: > > > > class PROCESSENTRY32 is repr('CStruct') { > > has int32 $.dwSize; > > has int32 $.cntUsage; > > has int32 $.th32ProcessID; > > has Pointer $.th32DefaultHeapID; > > has int32 $.th32ModuleID; > > has int32 $.cntThreads; > > has int32 $.th32ParentProcessID; > > has long $.pcPriClassBase; > > has int32 $.dwFlags; > > HAS Str @.szExeFile[260] is CArray;# MAX_PATH on windows is 260 > > Did you mean to capitalize the HAS? > > > }; > > > > > > ... is there is a raku method that gives me the size of this data > structure? > > > > In C for example one would use sizeof() to provide the size. In raku I > > could not find the documentation that would provide this information. > > > > Thanks, > > Paul Procacci > > Hi Paul, > > Not that I know of. Raku has a lot of things in > the background of its structures that C does not. > > C does not have OOP (object orientated programming) > but does have "struct", which is close enough. > > What you are trying to do is match the C structure > of the system call with Raku's OOP "class". In Raku, > "class" is the definition of a structure and not the > structure itself -- very much like C's "struct". > > You don't get an actual structure until you > declare one from the class. For example: > > my $x = PROCESSENTRY32.new; > > And it is going to be a lot bigger behind the scenes > that just adding up the bits. You really do not need > to know the behind the scene details anyway. Raku > strives to remove the need for the programmer to > have to know these kind of details, unlike C. > > What system call are you trying to run? > > I have an example of how to read Windows Time > that also uses OOP (class, object, and method). > Let me know if you want it > > -T > > > > -- __________________ :(){ :|:& };:Thread Previous | Thread Next