Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use macro for printing to stderr #273

Closed
wants to merge 1 commit into from
Closed

Use macro for printing to stderr #273

wants to merge 1 commit into from

Conversation

jeroen
Copy link

@jeroen jeroen commented Feb 16, 2020

We use libxlswriter in R, but we are not supposed to use fprintf(stderr, ...) because applications and IDEs that embed the R interpreter ignore this. Instead the interpreter has a function REprintf(...) which packages call for text that the IDE or embedding application has to print to the user terminal.

So I would need some way to override the error-printing function, either at build time or at runtime. Here is a simple concept solution. This would allow me to compile libxlsxwriter with

CFLAGS += -DLXW_PRINT_ERR=REprintf

And thereby I get the desired behavior. Alternatively you could create some sort of set-callback, but that would be more involved.

The drawback of this approach I suppose is that variadic macros require c99, which is not a problem for me, but I don't know how else I would do this.

Thanks for you thoughts!

@jmcnamara
Copy link
Owner

jmcnamara commented Feb 18, 2020

The drawback of this approach I suppose is that variadic macros require c99, which is not a problem for me,

That, unfortunately, is a deal break for libxlsxwriter since it needs to maintain backward (in both senses of the word) compatibility with ANSI C for MS Visual C.

However, I think I can fix it so you can use REprintf. Let me work on a solution.

See also, #155, which is related.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants