lucy-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nick Wellnhofer (JIRA)" <>
Subject [lucy-issues] [jira] [Resolved] (CLOWNFISH-53) Support MSVC in C mode
Date Mon, 27 Jul 2015 16:46:04 GMT


Nick Wellnhofer resolved CLOWNFISH-53.
       Resolution: Fixed
    Fix Version/s: 0.5.0

Fixed by initializing the problematic fields in a function.

> Support MSVC in C mode
> ----------------------
>                 Key: CLOWNFISH-53
>                 URL:
>             Project: Apache Lucy-Clownfish
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Nick Wellnhofer
>            Assignee: Nick Wellnhofer
>            Priority: Minor
>             Fix For: 0.5.0
> MSVC 12 which is part of Visual Studio 2013 has greatly improved support for C99. This
makes it possible to build Clownfish projects in normal C mode as opposed to C++ mode which
we traditionally used. I already switched to C mode for the Clownfish compiler and runtime.
> But there's a problem with projects linking to the Clownfish DLL. [As explained here|],
it's not possible to use the address of a global variable imported from a DLL via {{__declspec(dllimport)}}
in a global initializer. This is only a problem for C code. C++ has much fewer restrictions
regarding global initializers. We currently need this feature for the {{parent}} and {{parent_offset}}
fields in the class and method spec structs.
> I already hit the same problem with MinGW. I was able to circumvent it by simply omitting
{{__declspec(dllimport)}}. Further investigation showed that this works because of the {{--enable-auto-import}}
feature of MinGW's linker. Unfortunately, this is a GNU-only extension.
> I can think of a couple of different solutions.
> * Define all spec structs as local variables in a function.
> * Initialize the problematic fields in a function.
> * Lookup parent classes and parent method offsets by name.

This message was sent by Atlassian JIRA

View raw message