@code_native output to file

Hi,
Is there a way to save the output of @code_native to a txt file?
My ouput is very long and I can’t copy it manually to a file because it is more than the terminal buffer.
Thank you

I’m not sure if there’s a way to do this via the macro syntax, but you can use the function syntax to specify the io destination:

help?> code_native
search: code_native @code_native

  code_native([io=stdout,], f, types; syntax=:att, debuginfo=:default, binary=false, dump_module=true)

  Prints the native assembly instructions generated for running the method matching
  the given generic function and type signature to io.

The translation of @code_native f(a,b) is roughly code_native(stdout, f, typeof((a,b))). Replace stdout with a file handle (created via open) to dump to a file, for example.

2 Likes