Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005947OCamlotherlibspublic2013-03-12 18:412014-07-30 13:49
Assigned Todoligez 
PrioritynormalSeverityminorReproducibilityhave not tried
PlatformOSOS Version
Product Version4.00.1 
Target VersionFixed in Version 
Summary0005947: CAMLprim returning void
DescriptionSome C primitives of the OCaml otherlibs runtime returns void instead of ().
Some of them are declared "external" in some .ml files.
Obviously, it could cause a "Segmentation fault" if they are called from OCaml.
Steps To ReproduceTo search these invalid functions, run:

$ grep -RIni 'CAMLprim void' otherlibs
otherlibs/labltk/support/cltkImg.c:78:CAMLprim void
otherlibs/labltk/support/cltkImg.c:112:CAMLprim void camltk_setimgdata_bytecode(argv,argn)
otherlibs/labltk/support/cltkCaml.c:66:CAMLprim void tk_error(char *errmsg)
Additional InformationI think that "tk_error" is *not* an OCaml primitive, so you may just have to remove the CAMLprim attribute.

Functions camltk_setimgdata_bytecode and camltk_setimg_native are exported, so you just have to change signature and to return Val_unit.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
garrigue (manager)
2013-03-18 07:19

IIRC, the CAMLprim attribute on tk_error is to overcome restrictions on dependencies between DLLs on windows.
Namely other libraries, such as LablGL, need to access some utility functions from LablTk, and if they are not correctly flagged they are not avilable outside of the DLL.
(The maybe a better name that CAMLprim to do that, but I didn't check; actually CAMLprim is only used to register primitives in the byterun directory)
doligez (administrator)
2013-07-17 13:08

About tk_error, as far as I know you are supposed to use CAMLexport rather than CAMLprim in that case. This will need to be tested.
About the others, we need to decide if they are like tk_error or if they are really primitives, in which case they must return "value" rather than "void".
doligez (administrator)
2014-07-30 13:49

Labltk is now a separate package, so I've copied this PR to the labltk BTS on ocamlcore: [^]

Closing the report here, please continue the discussion on ocamlcore.

- Issue History
Date Modified Username Field Change
2013-03-12 18:41 bvaugon New Issue
2013-03-17 17:14 gasche Assigned To => doligez
2013-03-17 17:14 gasche Status new => assigned
2013-03-18 07:19 garrigue Note Added: 0008990
2013-07-12 09:45 doligez Target Version => 4.01.0+dev
2013-07-17 13:08 doligez Note Added: 0009797
2013-08-19 16:07 doligez Target Version 4.01.0+dev => 4.01.1+dev
2014-05-25 20:20 doligez Target Version 4.01.1+dev => 4.02.0+dev
2014-07-30 13:49 doligez Note Added: 0011941
2014-07-30 13:49 doligez Status assigned => resolved
2014-07-30 13:49 doligez Resolution open => suspended
2014-07-30 13:49 doligez Target Version 4.02.0+dev =>
2017-02-23 16:42 doligez Category OCaml otherlibs => otherlibs

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker