Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Writing Assembly on Perl

Tags:

perl

ffi

I want to write a small assembly code and call it from Perl :

I look at cpan and find those 2 Perl modules

  1. https://metacpan.org/pod/Inline::ASM which is very old
  2. https://metacpan.org/pod/FFI::Platypus::Lang::ASM which mention that it possible to call assembly from perl , i look at the examples but didn't find any example related to assembly code.

any idea how to use FFI::Platypus::Lang::ASM with Perl , an example will be appreciated

like image 437
jsor Avatar asked Dec 03 '25 15:12

jsor


1 Answers

any idea how to use FFI::Platypus::Lang::ASM with Perl , an example will be appreciated

The author of that module hasn't provided any examples for that code themselves. It looks like it may be an unfinished project.

Anyways, this is a pretty odd thing to want to do. Perl operates a couple levels of abstraction away from assembly -- interoperation between them is awkward at best.

A more practical solution will be to write C code which calls into your assembly code (or embeds it as inline assembly), then adapt that code to Perl using XS.