[MLton] symbol scopes

Matthew Fluet fluet at tti-c.org
Wed Nov 12 12:20:42 PST 2008


On Wed, 12 Nov 2008, Wesley W. Terpstra wrote:
>
> Now suppose we did what you propose: make dllimport/export the same
> tag. The definition of a function would be _symname, but uses of that
> symbol within another object final built into the DSO would be called
> __imp__symname. However, there is no __imp__symname in the resultin
> DLL, so you would get a link error. Thus the two tags cannot apply to
> the same symbol within a DSO.

O.k.  Given a time machine, this is what I would change.  When building a 
DLL, I would make it so that there are __imp_symname entries for *both* 
symbols imported from other DLLs and for symbols exported from this DLL. 
Then one could use *__imp_symname to access an exported symbol, regardless 
of whether that symbol is exported from the same DLL or from another DLL.

But, I can see that, given this time line, one needs to distinguish 
between 'public' and 'external' for Windows.

But, it also emphasizes the point that 'external' is the right default, 
because 'public' is almost certainly not the scope one wants.



More information about the MLton mailing list