I encountered an issue when building a native Windows DLL using Island and Mercury.
The project successfully produces a DLL, but using the documented named form of DllExport does not place the method in the DLL export table.
For example, this does not export int_add:
Public Shared Class Export
<DllExport("int_add")>
Public Function IntAdd(a As Int32, b As Int32) As Int32
Return a + b
End Function
End Class
The DLL builds successfully, but int_add does not appear in its exported symbols.
I verified the export table with:
llvm-readobj --coff-exports .\Library.dll
However, splitting the export name into a separate SymbolName aspect, and also adding Used, works correctly:
Public Shared Class Export
<DllExport>
<SymbolName("int_add")>
<Used>
Public Function IntAdd(a As Int32, b As Int32) As Int32
Return a + b
End Function
End Class
With this version, llvm-readobj shows the expected exported symbol:
Name: int_add
I also tested the exported function by loading the DLL through LoadLibrary, resolving int_add through GetProcAddress, and calling it from a small C program. The function was found and returned the expected result.
The same issue does not appear to occur in Oxygene. In an equivalent Island/Windows project, the following syntax directly exports the requested symbol:
[DllExport('int_add')]
class method IntAdd(a, b: Int32): Int32;
So the behavior currently appears to be:
Mercury:
<DllExport("int_add")>
→ symbol is not exported
Mercury:
<DllExport>
<SymbolName("int_add")>
<Used>
→ symbol is exported
Oxygene:
[DllExport('int_add')]
→ symbol is exported
Is this a Mercury compiler issue, or is the named DllExport argument not currently supported for Mercury on Island/Windows?
Update: Water version is 13.0.0.3095 (develop)
Built on bajor, 20260626-193532