[mercury-users] announced: libtiff foreign interface (caveats)

Julien Fischer juliensf at csse.unimelb.edu.au
Wed Feb 7 13:32:22 AEDT 2007


On Tue, 6 Feb 2007 doug.auclair at logicaltypes.com wrote:

> Dear all, Peter wrote:
>
>> The mutex only protects a single foreign_proc at a time.  It doesn't
>> prevent two instances of read_to_matrix or write_as_tiff from executing
>> at the same time, for example.  You'd need to get rid of the two globals
>> in libtiff_io.c and pass them around as parameters.
>
> *sigh!* And that was exactly why I wrote the warning as I did!  Change #2
> on its way.  Good catch, Peter!
>
> Two questions: does this change make the library thread safe? and,
> an unrelated question, I get the following warnings:
>
> ...
> tiffany.m: In function 'mercury__tiffany__write_as_tiff_2_0_i3':
> tiffany.m:160: warning: passing argument 1 of 'save_to_rgba_tiff_file_and_close' makes pointer from integer without a cast
> [etc]
> ...
>
> The cast it complains about is converting a c_pointer type to an external C pointer
> type!  Can this warning be eliminated? or am I writing code wrongly?  If so, how
> should I write the code so it doesn't generate these warnings?

You should use pragma foregin_type in preference to the C pointer 
type.  (The warning could be eliminated by adding casts to the external
type to the C code, but using pragma foreign_type should render this
unnecessary.)

Julien.
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the users mailing list