Foreign_archives in dune really seem to want a dll

I’m trying to include my self-built library (let’s call it libx.a), but when I include it in a “foreign_archives” stanza (foreign_archives ../my-library/x), dune really wants a dynamic library “dllx.so”, in addition to the static one. I wasn’t able to convince it otherwise, even with “disable_dynamically_linked_foreign_archives”.
Does anyone have any experience with this?

Yes, this is because a DLL is typically needed to link your library into pure bytecode executables. If you don’t care about bytecode, you can add (modes native) to your stanza.

Cheers,
Nicolas

1 Like

Ah that’s interesting. That works when I don’t have a ctypes stanza, but it seems like dune ctypes requires a bytecode build

(library) will also try to make a cmxs file for dynlinking, which requires a dynamic version of the foreign archive. You can disable this by adding (no_dynlink) to the stanza.