[openbeos] Re: static libs for drivers

  • From: "Ingo Weinhold" <bonefish@xxxxxxxxxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Sat, 17 May 2003 16:51:15 +0200 CEST

"Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx> wrote:
> "Waldemar Kornewald" <Waldemar.Kornewald@xxxxxx> wrote:
> > But the code itself is compiled with exceptions. A call to "new" 
> > might throw
> > an exception, but the driver has nothing that could handle this. 
> > Why 
> > are
> > exceptions and templates turned off when compiling a driver then?
> 
> Templates are allowed and working in the kernel - they don't rely on 
> any additional runtime libraries.
> But the rest is true, you have to compile your code without 
> exceptions 
> or RTTI. Therefore, you should use "KernelStaticLibrary" to compile a 
> static library for use in the kernel.
> Just have a look at other Jamfiles or our Jamrules directly, and 
> you'll 
> find lots of useful information.

I don't know, if KernelStaticLibrary is the right rule. AFAIK it is 
intended for static libs for our kernel, while for the networking stuff 
you will probably want to use BeOS for the time being.

What you want to your Jamfile is:

  SubDirCcFlags -D_KERNEL_MODE=1 -no-fpic ;
  SubDirC++Flags -D_KERNEL_MODE=1 -no-fpic -fno-exceptions -fno-rtti ;

The C++ flags disable exceptions and RTTI, if you don't want those. 
Unless I missed it, Axel hasn't put his cpp.{cpp,h} to public 
locations, so you will have to add also:

  LOCATE_SOURCE += [ FDirName $(OBOS_TOP) src add-ons kernel 
file_systems bfs ] ;
  SubDirHdrs [ FDirName $(OBOS_TOP) src add-ons kernel file_systems bfs 
] ;

And add `cpp.cpp' to your list of sources.

CU, Ingo


Other related posts: