Allow object fields to be visible in the C header #1189

Closed
gradha opened this Issue May 10, 2014 · 1 comment

Comments

Projects
None yet
2 participants
@gradha
Contributor

gradha commented May 10, 2014

Bitten again by the oversight of http://forum.nimrod-lang.org/t/96 which prevents me from initializing a Nimrod structure on the stack of a C calling function. Here is a small test case to compile with nimrod c --app:lib --header file.nim:

type
  Nice_scale {.exportc.} = object
    theValue {.exportc.}: float

proc use(x: var Nice_scale) {.exportc.} =
  X.theValue = 5

Compilation will generate a file.h with only the struct typedef.

Maybe the {.exportc.} pragmas for the fields should trigger an error or a warning about not being useful at all, since C doesn't have a concept of visibility.

@Araq Araq added the feature label Jun 30, 2014

@Araq

This comment has been minimized.

Show comment
Hide comment
@Araq

Araq Oct 21, 2016

Member

The --header switch will be removed.

Member

Araq commented Oct 21, 2016

The --header switch will be removed.

@Araq Araq closed this Oct 21, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment