Module for FreeRADIUS wirtten in C++

krzychk2 krzychk2 at tlen.pl
Tue Jul 21 21:46:01 CEST 2009


Dnia 2009-07-21, wto o godzinie 21:11 +0300, Ruslan Shevchenko pisze:
> > Dnia 2009-07-21, wto o godzinie 11:05 +0200, Alan DeKok pisze:
> >> krzychk2 wrote:
> >> > I have written a module for FreeRADIUS in C++. Now I have a big
> >> problem
> >> > with compilation.
> >>
> >>   C++ adds reserved words like "operator" that are legal to use in C.
> > And any other. It seems I have to change it by hand.
> >>
> >> > I am not familiar with mixing C with C++ so I would like to ask You
> >> for
> >> > help. I do not want to rewrite my code for C, because it will be such
> >> a
> >> > loss of my work.
> >>
> 
> Not binded to freeradius: usually you have three main issues with C/C++ code:
> 
> 1. different ABI
> 
> Solution: write set of functions (outside classes) for calling C++ code
> with modifier extern "C".
> 
> write rlm_<code> in C, using this "C" functions and header, which must be
> same for "C" and "C++" code.
> 
> 
> 2. different build process, which must call C++ compiler
> 
>  Solutions  build C++ code as shared library, and then let 'glue' rlm
> module will use one.
> 
> 
> 3. C++ require c++ standard library in LD_LIBRARY_PATH
>  (it's not a big issue, but when you move module to another machine, you
> can discover other version of c++ standard library: welcome to linux
> version of .dll hell)
> 
> 
> 
> 
Thanks a lot for Your help. For now I have changed 3 header files : 
conffile.h  libradius.h  radiusd.h
and changed "operator" to "oper" 
It seems the module has compiled, linked and it is now working.

I will try Your method tomorrow. Now when I am reading it, it is so
obvious :) 


-- 
krzychk2 <krzychk2 at tlen.pl>




More information about the Freeradius-Devel mailing list