Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: how to expose a simple const char *array[]?



On Mar 19,  3:59pm, Roman Neuhauser wrote:
}
} i'm trying to wrap the contents of Src/zshpaths.h in a module, initial
} smoke tests look ok except this one thing: FPATH_SUBDIRS as an array.
} the other modules that expose arrays use array_gsu structures as the
} values need to be generated on the fly.  my case should be simpler so i
} thought i'd get away without any fanfare, but it segfaults on access.

The only problem you have here is that FPATH_SUBDIRS is not terminated
with a final NULL element, but *fpath_subdirs[] must be so terminated
in order to be treated as an array parameter.

So your module will have to do something in its boot_() function to
copy from FPATH_SUBDIRS into an array one element longer, and poke a
NULL at the end.



Messages sorted by: Reverse Date, Date, Thread, Author