#FFI
15 messages · Page 1 of 1 (latest)
I think size_t equivalent is Int (or maybe UInt?) which is the size of the pointer in your machine.
thanks. It should be UInt since size_t is supposed to be unsigned
UInt was only recently introduced, so maybe it's not as complete as Int.
yeah, I've start to feel the pain with this. I've found nothing to convert to/from Int and even a basic & doesn't seems to exist 😋
Guess, it will be Int for now
I'm working on improving UInt but feel free to send PRs! It's pretty easy to get started with the stdlib 🙂
It's basically mapping those operations: https://mlir.llvm.org/docs/Dialects/IndexOps/ to dunder methods, while being careful to use the unsigned operations whenever available
Multi-Level IR Compiler Framework
Hi @thick chasm static linking isn't officialy supported yet, there is a hacky way to do it here until we add it though: https://github.com/ihnorton/mojo-ffi/tree/ffi-demo/mojo-exe-link-c-static
For size_t for our interop we've used Int for that in the stdlib, but UInt is more correct I haven't personally tried it yet with interop though
thanks. I've already found this and it's why I've asked for a "clean and official" way 😋
Congrats @thick chasm, you just advanced to level 1!
thanks. I'm "plumbing" Mojo with the libjpeg and I'll dive into MLIR after that
another question but I guess I know the answer. Any plan for LTO/PGO/BOLT ? BOLT could be the easier to enable as it usually rely on a LDFLAGS.
LTO is already done at the MLIR level, for the other two this was a comment from an engineer:
Profile guided optimization and BOLT are amazing technologies in my opinion, supporting them would be really cool. For PGO (sometimes also referred to as FDO -- feedback-directed optimization) would need to add options to the mojo driver to take profiles as inputs when compiling or running Mojo code.
BOLT refers to the optimization of fully compiled binaries -- in theory it might be possible to use already, with executables produced by mojo build.
thanks.
BOLT doesn't work, at least on my setup, that's why I've asked.
I've got this error :
BOLT-ERROR: function reordering only works when relocations are enabled
It's usually solved with something like "-Wl,--emit-relocs" in the LDFLAGS.
but it's no big deal, really.