Module for FreeRADIUS wirtten in C++

Ruslan Shevchenko rssh at gradsoft.com.ua
Tue Jul 21 20:11:51 CEST 2009


> 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)




>>   Is C++ really that different for simple modules?
>>
>>   Alan DeKok.
>
> This module is not so simple. It provides very complex authorization,
> authentication and postauthentication methods based on many backend
> systems. We want to integrate all this systems into one system with
> simple protocol. The simplest way was to write module in JAVA but taking
> the advantage of efficiency I have choose C++.
>
> In C the code will not be as consistent as I would like. Other scripting
> languages like python or perl - well maybe it is some kind of solution
> but now I do not have time for playing with them.
>
>
>
>
> --
> krzychk2 <krzychk2 at tlen.pl>
>
> -
> List info/subscribe/unsubscribe? See
> http://www.freeradius.org/list/devel.html
>





More information about the Freeradius-Devel mailing list