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

gradha opened this Issue May 10, 2014 · 1 comment


None yet
2 participants

gradha commented May 10, 2014

Bitten again by the oversight of 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:

  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


This comment has been minimized.

Show comment
Hide comment

Araq Oct 21, 2016


The --header switch will be removed.


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