BCS <[email protected]> wrote:

The issue is that the function called from module a is
_D1a3fooFZv where the function defined in module b is
_D1b3fooFZv ('a' <-> 'b') so they aren't the same function. extern(C) works because C doesn't mangle names so the function is foo in both cases.

I know. I just react to 'extern void foo();' being treated as a
function that must be in a. I would expect extern to indicate it lies
elsewhere in the program.


You can resolve this by having a a.di file with the extern foo(); in it (DMD has a flag to generate such a file for you). OTOH without knowing what you are doing, I can't tell if this is the correct solution.

I'm trying to create a framework in which the user may provide his own
foo( ), so the name of module b is impossible to know.


torhu <[email protected]> wrote:
You could always create a b.di file, if that doesn't defeat the purpose.

Jonathan M Davis <[email protected]> wrote:
Um, extern isn't needed in D. All you need to do is make the function public and then import the module.

If only life were easy, eh? Module b is user-supplied, so I can't import
it.

--
Simen

Reply via email to