Hello,
I am trying to write a ffi interface to apache httpd windows dlls, and I ran
into the issue of name mangling.
I can solve this problem for the particular version of dlls which I am using
but it is not a generic/portable solution for different platforms.
In particular I would like to quote Roger Corman (the main person behind
Corman Lisp) on the topic of name mangling and automatically taking care of it
in ffi interfaces (back in 2003), aka. decoration:
You could try to make it easier by doing his automatically, but you don't
in general know what name mangling scheme was used (if any was used). DLLs
may have been generated by different compilers. In Corman Lisp FFI I ignore
it and let the user worry about it. If they call a mangled name, they have
to explicitly specify that name. Nobody has complained, probably because
most exported functions do not have mangled names (if they support a C
interface anyway).
The Microsoft C++ compiler automatically does the name mangling unless you
tell it otherwise.
This is to catch problems (incorrect declarations) at link time rather than
run time.
However, you can disable it when you build (link) a DLL by including a .def
file,
with the names explicitly listed.
Microsoft does this for all their system DLLs. The names are not mangled.
So, I will request that future release of apache, should try to avoid dlls
with mangled names.
Any comments?
Thanks for your consideration.
--
Surendra Singhi
http://www.public.asu.edu/~sksinghi/index.html
All animals are equal, but some animals are more equal than others.
- Orwell, Animal Farm, 1945