xavierleroy / camlidl

Stub code generator for OCaml/C interface
Other
34 stars 8 forks source link

(Breaking) change of behavior for `[string]const char*` since version 1.10 #23

Closed nberth closed 1 year ago

nberth commented 1 year ago

Since version 1.10, const char* arguments declared with string attribute, that were translated as string arguments on the OCaml side with earlier versions, are now typed char option. In addition, a "Warning: `string' attribute applies only to arrays of characters, ignored" is raised on such declarations. Removing the const solves the issue (at the expense of potential new warnings in C stubs though); I'm wondering whether this change was intended.

void f([string]const char *x);

with 1.10 gives:

external f : char option -> unit
    = "camlidl_x_f"

whereas with 1.09 we had:

external f : string -> unit
    = "camlidl_x_f"
xavierleroy commented 1 year ago

This change was not intended. Thanks for reporting it.

xavierleroy commented 1 year ago

I just pushed a fix to the master branch. Do you think you could test it on your examples? This would make me more confident in the fix before making a new release.

nberth commented 1 year ago

I just pushed a fix to the master branch. Do you think you could test it on your examples? This would make me more confident in the fix before making a new release.

Sure! I'll test and report here ASAP.

nberth commented 1 year ago

I've exploited the opam CI to further check that many known packages that depend on camlidl still compile properly, and my manual tests also went fine. So I think this version is good to release.

Thanks a lot for the quick fix!

xavierleroy commented 1 year ago

Thanks a lot for the extensive testing! I just released version 1.11 incorporating the fix.

kit-ty-kate commented 1 year ago

Could there be an entry in the changelog for 1.11 ?

xavierleroy commented 1 year ago

There can be: e53d745