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

camlidl: unique attrubute is ignored for bigarray pointers #2847

Closed
vicuna opened this issue Jul 22, 2001 · 1 comment
Closed

camlidl: unique attrubute is ignored for bigarray pointers #2847

vicuna opened this issue Jul 22, 2001 · 1 comment

Comments

@vicuna
Copy link

vicuna commented Jul 22, 2001

Original bug ID: 448
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: -for CamlIDL use https://github.com/xavierleroy/camlidl/issues

Bug description

Full_Name: Dmitry Bely
Version: camlidl current cvs
OS: Windows NT 4.0

The following IDL definition

typedef struct {
int imageLen;
[size_is(len),unique,bigarray] char *imageData;
} Image;

produces

type struct_1 = (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
and image = struct_1

i.e. silently ignores "unique" attribute without warning/error
message. IMHO that's not good. I'd like it to produce

type struct_1 = (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t option
and someData = struct_1

as well as

typedef struct {
int imageLen;
[size_is(len),unique] char *imageData;
} Image

produces

type struct_1 = char array option
and image = struct_1

Why I need it:
There is a library that uses similar structure as an image
descriptor. "imageData" is allocated/deallocated by special library
functions, and is linked with some internal data, so "bigarray" is the only
option to access/modify it from caml "in place". The problem is that
allocation process is done in two stages:

Image img;
AllocHeader( &img, .... );
/* fill other fields in the structure; imageData == NULL on return /
AllocData( &img );
/
allocate memory for image depending on the header; /
/
imageData != NULL, imageLen > 0 on return */

Unfortunately that "NULL bigarray pointer" cannot be adequately described
in caml IDL, until "unique" attribute is supported for bigarray
pointers. Even worse, if we now have NULL pointer to bigarray data passed
to caml, its runtime will silently create stat_alloc'ed 1-element array
itself. C-library will be quite surprised then ...

Hope to hear from you soon,
Dmitry

P.S.

I feel that such my messages are too much for caml-bugs :-) Maybe it's the
topic for caml mailing list? The only problem is that very few its
subscribers (if any) use camlidl ...

@vicuna
Copy link
Author

vicuna commented Jul 30, 2001

Comment author: administrator

Added support for [unique] bigarrays. XL, 2001-07-30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant