mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-16 09:53:36 +00:00
Fix a mismatch in the mangling of symbol names between the name mangling
module in the browser / dynamic linking library and the MLDS->C code generator.
The former includes the function return argument in the arity, while the latter
does not.
Make the dynamic linking examples work in low-level C grades on OS X and mostly
work in high-level C grades. (I say "mostly", since the integer function test
returns an incorrect result on my machine.)
browser/name_mangle.m:
The arity for symbols corresponding to Mercury functions should not
include the return argument.
Add a comment mentioning that this module needs to be kept in sync
with the name mangling scheme used in compiler/mlds_to_c.m.
s/XXX/NOTE/ in a spot.
compiler/mlds_to_c.m:
Add a comment mentioning that the name mangling code here needs to be
kept in sync with the mlds version of the name mangling code
in browser/name_mangle.m.
extras/dynamic_linking/Mmakefile:
Use the variable EXT_FOR_SHARED_LIBS rather than assuming that the
shared library extension is .so.
extras/dynamic_linking/dl_test.m:
extras/dynamic_linking/dl_test2.m:
Open 'libhello.dylib' on OS X systems rather than 'libhello.so'.
This directory contains the following files: dl.m: A module containing support for dynamic linking (i.e. a binding to the C functions dlopen(), dlsym(), and dlclose()). name_mangle.m: A module containing a representation for Mercury procedure specifiers and a function for mangling them into symbol names suitable for passing to dlsym(). dl_test.m: hello.m: dl_test.exp: A sample program (and test case) for the use of dynamic linking.