Re: [rvm-research] Passing a String Array to a System Call in Jikes

Robin Garner <[email protected]> Mon, 19 Feb 2018 12:35:56 +1100
Newsgroups gmane.comp.java.jikes.rvm.devel
Message-ID <[email protected]>
Hi Khaled, you're essentially right, but there are subtleties.

On 17/02/18 19:00, Khaled Z Mahmoud wrote:
> Hi,
>
> After some trial error and guessing ... The string array can be passed 
> a byte array.
> That is ---> byte[][]
>
> Just convert the string to an array of bytes using str.getBytes();
If you want C code to see the bytes as a string, you'll need to null 
terminate it first.  See MMTk's Statistics class for one example.

Make sure your called code uses strcpy (or equivalent) rather than 
saving the array pointer (if it hangs on to the string), as the arrays 
could be moved during GC after the call is complete.

cheers,
Robin
>
>
>
> On Fri, Feb 16, 2018 at 5:49 PM, Khaled Z Mahmoud 
> <[email protected] <mailto:[email protected]>> wrote:
>
>     Hi,
>
>     How do I pass an array of String to a system call in Jikes ?
>
>
>     -- 
>     Regards,
>     Khaled Mahmoud
>
>
>
>
> -- 
> Regards,
> Khaled Mahmoud
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>
>
> _______________________________________________
> Jikesrvm-researchers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Jikesrvm-researchers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers