May 27, 2021

I have built 2 windows C dlls (ctst and ctst2) that I am calling from a Dlang exe (dtstx). dumpbin shows the exports.

dpp was used to generate the d file from #includes.

All this works perfectly on Linux and MacOS.

(Are the generated d files portable? They seem to be. I have also generated them on Windows just in case.)

dtstx calls ctst_init() and ctst2_init().

import c_libs;

int mymain(string[] args) {
    string str = "dlang";
    return ctst_init(str.toStringz) + ctst2_init(str.toStringz);
}

If I call just one of the fns ctst_init and ctst2_init, it works.

However, calling both gives either of these errors:

In dub.sdl

libs "lib/ctst" "lib/ctst2" platform="windows"

causes dtstx to generate

---------------------------
dtstx.exe - Entry Point Not Found
---------------------------
The procedure entry point ctst2_init could not be located in the dynamic link library ........\dtstx\bin\dtstx.exe.
---------------------------

In dub.sdl, reversing the order of the libs:

libs "lib/ctst2" "lib/ctst" platform="windows"

causes dtstx to generate

---------------------------
dtstx.exe - Entry Point Not Found
---------------------------
The procedure entry point ctst_init could not be located in the dynamic link library ........\dtstx\bin\dtstx.exe.
---------------------------