Jbuilder: C stubs in main executable?

I’m porting an existing project to jbuilder. The project uses C stub files as part of the main program and does not define a separate library for them. Is this supported in jbuilder? Or would I have to create a library for them and (presumably) move these files into their own directory? The manual suggests that C stubs are only supported in libraries.

From my one day experience with jbuilder I would say that I don’t see why not, but the documentation doesn’t seem specify C stub stanzas for executable. Why not put your modules containing in the C stubs in a separate directory and build them as a library?

This might a design decision to promote a certain project structure. They do seem to want a library per directory if you see at “Project Layout” section.

Your understanding is correct. You will need to define a library to use c_stubs. Although you might not have to create a new directory if you carefully use the (modules (...)) to state which modules a stanza should use.