Skip to content

linking_to attribute is no longer supported in cpp_source() #193

Closed
@paleolimbot

Description

@paleolimbot

This came from a recent build failure for a pkgdown article that uses the cpp11 knitr engine. I don't think I'm using the attribute incorrectly but it's certainly possible!

Reprex from the cpp_source() example page:

cpp11::cpp_source(
  code = '
#include <cpp11/R.hpp>
#include <RProgress.h>

[[cpp11::linking_to("progress")]]

[[cpp11::register]] void
show_progress() {
  RProgress::RProgress pb("Downloading [:bar] ETA: :eta");

  pb.tick(0);
  for (int i = 0; i < 100; i++) {
    usleep(2.0 / 100 * 1000000);
    pb.tick();
  }
}
')
#> Error: cpp11 attributes must be either `cpp11::register` or `cpp11::init`:
#> - Invalid attribute `cpp11::linking_to` on
#> line 5 in file '/var/folders/bq/2rcjstv90nx1_wrt8d3gqw6m0000gn/T//RtmpH9kS6D/file2d7a258fb142/src/code_2d7a7cbe7751.cpp'.

Would it make sense to add linking_to to the list of allowed decorations here?

bad_decor <- !decorations$decoration %in% c("cpp11::register", "cpp11::init")

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions