D and .lib files. C++/Other?
Nicholas Wilson via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Jul 1 23:24:58 PDT 2017
On Sunday, 2 July 2017 at 05:33:45 UTC, Damien Gibson wrote:
> K im retarded... So I forgot the golden rule, debug libs with
> debug app, release libs with release app.. I attempted loading
> the debug version of dll with D again just to see what kinda
> errors (may) come up there, sure enough there is and i get a
> fairly detailed one... However, when the function ConsoleWrite
> is called in either project, it goes back to the close bracket
> on the myclass.d page(The original myclass.d from the actual
> dll source code) and then re[prts stdio.d "in gc_malloc"
>
Ahh, you need to initialise the D runtime before you call any
functions that depend on it (e.g. ones that interact with the
file system).
declare
extern "C" int rt_init();
in your c++ code and call it before ConsoleWrite and it should
work.
> At this point I am thoroughly confused... It has only done this
> since adding the extern(C) tag to the source... even changing
> that to C++(Where depends.exe reports a garbled mess of a name
> again) still reports the same issue.
That "garbled mess" is the microsoft C++ mangling of the symbol,
its supposed to look like that.
More information about the Digitalmars-d-learn
mailing list