Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Sep 2003 11:35:37 -0600
From:      John Giacomoni <John.Giacomoni@colorado.edu>
To:        freebsd-hackers@freebsd.org
Subject:   C++ code in a kernel module?
Message-ID:  <DBE1CF41-E222-11D7-80D8-0003930719D8@colorado.edu>

next in thread | raw e-mail | index | archive | help
How would one go about creating a kernel module which utilizes
C++  code?

I was planning on using the macro __cplusplus to toggle using
extern "C" { }, however the bsd.kmod.mk style Makefiles seem to
force the language to -std=c99 even when compiling with c++ .

my initial steps have been as follows:
take a functioning C based kernel module and rename to .cc
added extern "C" around the includes.
#defined key words such as new to xxx_new
recompiled the new .cc file by hand without -std=c99, but
keeping all the flags as the Makefile set them.
then linked using the Makefile and finally loaded the module.

as long as I do not make any calls into kernel functions
things seem to work (load), however when I make a call to
mtx_init then on load i get the following error:
__gxx_personality_v0 undefined.

thoughts/ideas/suggestions?

thanks

John G



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?DBE1CF41-E222-11D7-80D8-0003930719D8>