DMD Refuses to Compile Multiple Source Files
Samwise via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Jan 17 19:37:46 PST 2017
On Wednesday, 18 January 2017 at 03:25:47 UTC, Stefan Koch wrote:
> On Wednesday, 18 January 2017 at 03:11:08 UTC, Samwise wrote:
>> On Wednesday, 18 January 2017 at 02:48:45 UTC, James Buren
>> wrote:
>>> Import the source file containing the external function
>>> instead of writing that prototype. It should compile then.
>>
>> This seems like a workaround more than a permanent solution.
>> It would work, but still. I'm also not sure about the syntax
>> for that (Given that getReturnCode.d is in the same directory
>> as hello.d).
>> ~Sam
> In extern (D) functions (which is the default)
> The module name is part of the mangled name.
> What you are trying to do would work ,
> if the getReturnType would be extern(C).
Without changing anything about the hello.d file from above, and
the only change being adding the extern keyword to the
getReturnValue.d like this:
extern int getReturnCode() {
return 4;
}
still does not compile using the command from above. I may very
well be misunderstanding you though. I've not been doing this
particularly long...
~Sam
More information about the Digitalmars-d-learn
mailing list