[erlang-questions] Passing data between Erlang and C port while preserving padding and alignment?

Vance Shipley vances@REDACTED
Fri Dec 7 09:17:59 CET 2018


On Fri, Dec 7, 2018 at 9:51 AM Frank Muller <frank.muller.erl@REDACTED> wrote:
> Question: how can I derive the GCC's padding, and automatically add it to my Erlang binary?

Frank,

I used to write linked-in drivers for embedded systems which provided
C library APIs. Back in those days I was building for 32 & 64 bit, x86
& SPARC. I used GNU autotools to figure out the target environment and
generate macros in my Erlang header files. It all worked quite
smoothly in the end.  I'd be happy to send you an example project if
you think it'd helpful.

To your specific question I think the autoconf macro AC_CHECK_ALIGNOF
does what you want:
     https://www.gnu.org/software/autoconf/manual/autoconf-2.67/html_node/Generic-Compiler-Characteristics.html

-- 
     -Vance



More information about the erlang-questions mailing list