# Memalign



## comfortableodo (Nov 13, 2010)

Dear all,

I have got a question about the function memalign, which seems to be heavily used in the Linux world. I need to compile a program (NWchem) which seems to make use of memalign and hence doesn't compile on FreeBSD 8.1 amd64 without patching. 

Would there be any (simple) solution to avoid this issue, e.g. substitute the memalign function with something FreeBSD compatible? I could try to use/adapt a patch for FreeBSD 7.0-current i386 ( http://lists.freebsd.org/pipermail/freebsd-bugs/2005-August/014327.html ), but because I am not a programmer, it would probably cause me a lot of problems and headaches and as far as I understand I also would need to rebuild the world?!

Thanks!


----------



## jilles@ (Nov 13, 2010)

You can use posix_memalign(). Note that it has a slightly different calling convention.


----------

