[m-rev.] diff: allow semaphore mutables in hlc grades
Peter Wang
novalazy at gmail.com
Thu Nov 3 12:03:58 AEDT 2011
Branches: main
Work around bug #19 for `thread.semaphore'. In general, foreign type
mutables don't work in high-level C grades due to the order of variable
declarations and header file #includes.
library/thread.semaphore.m:
Change the foreign_type of `thread.semaphore' to use the struct tag
so that the variable declaration works without having seen the
typedef for `ML_Semaphore'.
diff --git a/library/thread.semaphore.m b/library/thread.semaphore.m
index 19c2004..0a050db 100644
--- a/library/thread.semaphore.m
+++ b/library/thread.semaphore.m
@@ -100,7 +100,8 @@ public class ML_Semaphore {
};
").
-:- pragma foreign_type("C", semaphore, "ML_Semaphore *",
+ % XXX the struct tag works around bug #19 in high-level C grades
+:- pragma foreign_type("C", semaphore, "struct ML_SEMAPHORE_STRUCT *",
[can_pass_as_mercury_type]).
:- pragma foreign_type("IL", semaphore,
"class [mercury]mercury.thread.semaphore__csharp_code.mercury_code.ML_Semaphore").
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list