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

Compatibility with webR #543

Merged
merged 2 commits into from
Nov 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Makevars
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PKG_CFLAGS = $(C_VISIBILITY)
6 changes: 6 additions & 0 deletions src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
#include <R_ext/Rdynload.h>
#include <Rversion.h>

// Compile with `C_VISIBILITY = -fvisibility=hidden` if you link to
// this library
#include <R_ext/Visibility.h>
#define r_export attribute_visible extern

SEXP clic_unload(void) {
clic_stop_thread();
return R_NilValue;
Expand Down Expand Up @@ -86,6 +91,7 @@ static const R_CallMethodDef callMethods[] = {

#define RCC(fun) R_RegisterCCallable("cli", # fun, (DL_FUNC) fun);

r_export
void R_init_cli(DllInfo *dll) {
#if R_VERSION >= R_Version(3, 5, 0)
cli_init_altrep(dll);
Expand Down
4 changes: 4 additions & 0 deletions src/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ int cli__start_thread(SEXP ticktime, SEXP speedtime) {
cli__tick_ts.tv_nsec = (cticktime % 1000) * 1000 * 1000;
int ret = 0;

#ifdef __EMSCRIPTEN__
cli__reset = 0;
#else
if (! getenv("CLI_NO_THREAD")) {
ret = pthread_create(
& tick_thread,
Expand All @@ -63,6 +66,7 @@ int cli__start_thread(SEXP ticktime, SEXP speedtime) {
} else {
cli__reset = 0;
}
#endif

return ret;
}
Expand Down