Skip to content

Commit

Permalink
Fix error printing in c-example (#249)
Browse files Browse the repository at this point in the history
  • Loading branch information
WardBrian authored Oct 17, 2024
1 parent e273c8d commit 3a35413
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion c-example/example.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ int main(int argc, char** argv) {
bs_model* model = bs_model_construct(data, 123, &err);
if (!model) {
if (err) {
printf("Error: %s", err);
fprintf(stderr, "Error: %s\n", err);
bs_free_error_msg(err);
}
return 1;
Expand Down
4 changes: 2 additions & 2 deletions c-example/runtime_loading.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ int main(int argc, char** argv) {
int major = *(int*)dlsym(handle, "bs_major_version");
int minor = *(int*)dlsym(handle, "bs_minor_version");
int patch = *(int*)dlsym(handle, "bs_patch_version");
fprintf(stderr, "Using BridgeStan version %d.%d.%d\n", major, minor, patch);
printf("Using BridgeStan version %d.%d.%d\n", major, minor, patch);

// Get function pointers. Uses C23's typeof to re-use bridgestan.h
// definitions. We could also write out the types and not include bridgestan.h
Expand All @@ -76,7 +76,7 @@ int main(int argc, char** argv) {
bs_model* model = bs_model_construct(data, 123, &err);
if (!model) {
if (err) {
printf("Error: %s", err);
fprintf(stderr, "Error: %s\n", err);
bs_free_error_msg(err);
}
return 1;
Expand Down

0 comments on commit 3a35413

Please sign in to comment.