core.runtime: loadLibrary and unloadLibrary?

H. S. Teoh hsteoh at quickfur.ath.cx
Fri Jan 11 12:41:45 PST 2013


On Fri, Jan 11, 2013 at 11:26:33AM -0800, Sean Kelly wrote:
> On Jan 11, 2013, at 7:34 AM, Phil Lavoie <maidenphil at hotmail.com> wrote:
> 
> > Anyone else finds themself desiring a "loadSymbol( void *
> > whateverReturnedByLoadLib, string name )" function?
> 
> Please submit an enhancement request :-)

Is it safe to use void* for representing _both_ variables and functions?

I know in C++ this was a problem in the standard, because a function
pointer may not be the same size as a pointer to a variable, and
therefore dlsym technically has undefined behaviour (though I doubt if
any implementation actually doesn't work).

What's the situation in D? What if the library exports delegates? Would
it be dangerous to cast it to void*? Do we need separate functions for
loading function symbols vs. data symbols?


T

-- 
Give me some fresh salted fish, please.


More information about the Digitalmars-d mailing list