D: Fix name collision between im D module function pointer and actual C function.
Previously, the function pointers were not only declared with extern(C) calling convention, but actually had C linkage themselves. Thus, they were exported under their bare names, potentially colliding with the actual function definitions in the wrapped library if the dynamic linker decided to resolve them the wrong way. This fixes the sneaky1 test case, although I have no idea why the add() reference in D_add() (via the PLT) is rebound to the function pointer there and not in all other test cases and real-world libraries. As far as I can see, there don't seem to be any special symbol visibility/binding settings involved in our build system.
This commit is contained in:
parent
95e8db7c62
commit
0d6472525c
1 changed files with 1 additions and 1 deletions
|
|
@ -2594,7 +2594,7 @@ private:
|
|||
const_String_or_char_ptr wrapper_function_name) {
|
||||
|
||||
// TODO: Add support for static linking here.
|
||||
Printf(im_dmodule_code, "extern(C) %s function%s %s;\n", return_type,
|
||||
Printf(im_dmodule_code, "SwigExternC!(%s function%s) %s;\n", return_type,
|
||||
parameters, d_name);
|
||||
Printv(wrapper_loader_bind_code, wrapper_loader_bind_command, NIL);
|
||||
Replaceall(wrapper_loader_bind_code, "$function", d_name);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue