Function reference accross modules => link error: unresolved external

Robert M. Münch robert.muench at saphirion.com
Wed May 8 17:30:46 UTC 2019


On 2019-05-08 17:02:07 +0000, Adam D. Ruppe said:

> Those are two *entirely different* functions, `a.otherFunc` and 
> `myapp.otherFunc`.

That's what I expected...

> Generally the answer here is "don't do that". Just have module a 
> `import myapp` and then call otherFunc.

That's exactly what I want to avoid because "module a" is a generic one 
and shouldn't be touched to add any reference to user-specific code. In 
this case that would be the module name.

> But if you must hack around it - and seriously ask yourself if this is 
> good design before committing to it - you can slap `extern(C)` on the 
> `otherFunc` declaraton and definition to force them to match up in the 
> global namespace.

Thanks, I didn't thought that I need to go the C road for this.

-- 
Robert M. Münch
http://www.saphirion.com
smarter | better | faster
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20190508/d633d003/attachment.html>


More information about the Digitalmars-d-learn mailing list