Elegant way to use dynamic bindings
Mike Parker
aldacron at gmail.com
Fri Feb 9 14:51:30 UTC 2018
On Friday, 9 February 2018 at 14:04:05 UTC, Dennis wrote:
> I added `pragma(lib, "mupen64plus.lib");` above the extern(C)
> block.
> Adding `libs "mupen64plus"` to dub.sdl doesn't make a
> difference.
Where was the lib file located? Was it in the root project
directory? How are you compiling your project? What does your
directory tree look like?
>
> The thing that confuses me is that the import lib has symbols
> without underscore prefix (I see them when running `libunres -p
> mupen64plus.lib`), but when I change the function pointer
> declaration into a function declaration it tries to link
> "_CoreGetAPIVersions" and can't find it.
Yes, the underscore is normally prepended to cdecl functions on
Windows. It makes no difference if your function prototypes are
properly declared.
>
> I put the .dll's in the root of the project directory by the
> way. Does that count as a "system library search path"?
That depends. Is that the directory where your executable is
written? Are you launching it from inside an Visual Studio or
from the command line? Normally, the executable's directory is on
the system path, but when using VS the default configuration is
to write the executables into configuration-specific
subdirectories.
More information about the Digitalmars-d-learn
mailing list