lucy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Wellnhofer <wellnho...@aevum.de>
Subject Re: [lucy-dev] Hiding struct defs
Date Tue, 10 Apr 2012 19:00:39 GMT
On 25/03/2012 21:22, Marvin Humphrey wrote:
> On Sun, Mar 25, 2012 at 12:16 PM, Nick Wellnhofer<wellnhofer@aevum.de>  wrote:
>> It's not the extensions that need the struct definitions, it's the code in
>> parcel.c:
>>
>> /* Define the variable which holds this class's class name.
>>   */
>>
>> static cfish_ZombieCharBuf LUCY_QUERY_CLASS_NAME = {
>>     CFISH_ZOMBIECHARBUF,
>>     {1}, /* ref.count */
>>     "Lucy::Search::Query",
>>     19,
>>     0
>> };
>>
>> When building Lucy, CharBuf and VTable are automatically included with
>> struct definitions. But in extensions this is not the case.
>
> Got it.
>
> I believe that the solution is to define VTables using a bootstrapping
> function at startup rather than define them statically at compile-time.

The attached patch contains are a rough attempt to initialize the 
VTables at run-time. I also tried to malloc the VTables dynamically, but 
this broke RAWPOSTING_BLANK where a VTable is used to initialize a 
global struct.

The patch also moves the code to register the VTables from boot.c to 
parcel.c which seemed like the right place, because this initialization 
code does not depend on the host language.

Nick

Mime
View raw message