You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucy.apache.org by "Nick Wellnhofer (JIRA)" <ji...@apache.org> on 2015/07/27 18:46:04 UTC
[lucy-issues] [jira] [Resolved] (CLOWNFISH-53) Support MSVC in C mode
[ https://issues.apache.org/jira/browse/CLOWNFISH-53?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
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: https://issues.apache.org/jira/browse/CLOWNFISH-53
> 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|https://msdn.microsoft.com/en-us/library/twa2aw10.aspx], 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
(v6.3.4#6332)