Moving to Dune 2.0 for C stubs

I have a project with C stubs that requires an extended list of C headers and links against a list of libraries. This worked so far with the following Dune file:

(library
  (name lpe)
  (c_names lpe_stubs)
  (c_flags
   -g
   -O2
   -fPIC
   -std=c99
   -Wimplicit-function-declaration
   -DPLATFORM_UNIX
   -DOS_LINUX
   -DCOMPILE_NATIVE
   -I/usr/lib64/ocaml
   -I/usr/include/lpe
   -I/usr/include/flexlm
  )
  (c_library_flags
   -L/usr/lib64/lpe
   -L/usr/lib64/flexlm
   /usr/lib64/flexlm/lm_new.o
   -lLicHelper
   -lMFLic
   -lVDHelper
   -laphelper
   -lProdLic
   -lreglib
   -lctxstringmaps
   -linilib
   -llmgr -lcrvs -lsb -lnoact -llmgr_dongle_stub
   -lstdc++
   -lpthread -ldb -lm -lc
  )
  (wrapped false)
)

I struggle to move this to Dune 2.0 because I don’t understand how to properly pass the list of linker flags in the new world. Who can help me?

1 Like

Hello,

I believe you should still use c_library_flags in Dune 2.0. The new “foreign stubs” fields are only concerned with compilation, not linking.

Cheers,
Nicolás

5 Likes