0

We were migrating Jansson 2.7 to Jansson 2.14 in Embarcadero C++Builder. After successfully added to the project, we are getting the following error, which comes from Jansson -> dump.c:

[bcc32 Error] dump.c(443): E2063 Illegal initialization

size_t json_dumpb(const json_t *json, char *buffer, size_t size, size_t flags) {
    struct buffer buf = {size, 0, buffer};  // <-- **Throws Error**

    if (json_dump_callback(json, dump_to_buffer, (void *)&buf, flags))
        return 0;

    return buf.used;
}

enter image description here

Aravind
  • 1,521
  • 2
  • 12
  • 23
  • 1
    It's extremely confusing to have `char *buffer` and `struct buffer buf` in the same scope. You are not making it fun for the maintenance crew :) What's the definition of `struct buffer`? – Ted Lyngmo Mar 06 '23 at 16:50
  • 2
    Have you tried simply renaming the `char *buffer` parameter? – Remy Lebeau Mar 06 '23 at 19:20
  • I have tried changing the name of char *buffer . But getting the same error – Aravind Mar 07 '23 at 04:39
  • You still haven't shown the definition of `struct buffer` which is sort of the main thing here since it's there you get the initialization error. – Ted Lyngmo Mar 07 '23 at 15:03

0 Answers0