Sponsored by vStack.
Details
Details
- Reviewers
jhb markj imp - Group Reviewers
bhyve - Commits
- rG1228a047aa65: libvmm: add __BEGIN_DECLS/__END_DECLS for linking with c++ binaries
$ cat vmopen.cpp
#include <dlfcn.h> #include <err.h> #include <vmmapi.h> typedef void (*vm_close_fn)(struct vmctx *ctx); int main(int argc, char *argv[]) { const char *vmname = argc > 1 ? argv[1] : "-"; struct vmctx *ctx; vm_close_fn __vm_close = (vm_close_fn)dlsym(RTLD_NEXT, "vm_close"); ctx = vm_open(vmname); if (ctx == NULL) err(1, "cannot open vm device: %s", vmname); if (__vm_close) __vm_close(ctx); }
Compilation and linking
$ c++ vmopen.cpp -I /data/freebsd/HEAD/lib/libvmmapi/ -L /data/freebsd/HEAD/lib/libvmmapi/ -lvmmapi
Without patch command above produces:
ld: error: undefined symbol: vm_open(char const*)
With patch - success.
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
lib/libvmmapi/vmmapi.h | ||
---|---|---|
36 | Conventionally, cdefs.h is included first (see style(9)). So: #include <sys/cdefs.h> #include <sys/param.h> #include ... |