Boost logo

Boost :

Subject: Re: [boost] JNI library
From: Dave Abrahams (dave_at_[hidden])
Date: 2012-06-28 15:00:55


on Thu Jun 28 2012, Felipe Magno de Almeida <felipe.m.almeida-AT-gmail.com> wrote:

> On Thu, Jun 28, 2012 at 9:14 AM, Dave Abrahams <dave_at_[hidden]> wrote:
>>
>> on Tue Jun 26 2012, Felipe Magno de Almeida <felipe.m.almeida-AT-gmail.com> wrote:
>>
>>> On Fri, Jun 22, 2012 at 3:02 PM, Dave Abrahams <dave_at_[hidden]> wrote:
>>>>
>
>>>> on Sun Jun 17 2012, Felipe Magno de Almeida <felipe.m.almeida-AT-gmail.com> wrote:
>>>>
>>>
>>> [snip]
>>>
>>>>> This class file could be generated by the javabind library, but I
>>>>> thought it would be overkill for what I needed and might actually make
>>>>> the loading time longer, since it would have to be generated.
>>>>
>>>> You don't have to generate it at (java) runtime.
>>>
>>> Do you mean what I already do: generate it by writing java code and
>>> compiling. Or at compile-time? Or something else?
>>
>> I mean that you can build the generation of the Java code into the
>> capabilities of your binding library.  Doesn't the C++ binding
>> description contain all the information you need to generate the Java
>> code?  If so, you could generate it from C++,
>
> Yes it does, and yes I can. But generating from C++ might be costly
> at initialization-time if I had to do it for hundreds of methods, which is
> the case for me. I will give this a try next week and see if it really
> performs wells.

You can do it earlier than "initialization time," can't you? Invoke the
library in a special mode that just generates Java files?

> If you know how to create a contiguous buffer composed with data
> from c-style strings strictly at compile-time without constexpr that
> surely would solve any problems I could have with initialization time.
>
> You may know how from this code:
>
> register_class<my_class>("MyClass")
> [
> function("Foo", &my_class::foo)
> , function("Bar", &my_class::bar)
> ];
>
> I can create a contiguous buffer of size N with these strings without
> copying at runtime?

Doubtful.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk