Re: Elegant way to use dynamic bindings

2018-03-08 Thread Dennis via Digitalmars-d-learn
On Friday, 9 February 2018 at 20:19:33 UTC, Dennis wrote: I'd still like to find a nice way to generate the boilerplate code for dynamic loading, if I come up with something I'll post it here. So I ended up using an import library for a while, but I then wanted to get the handle of the DLL,

Re: Elegant way to use dynamic bindings

2018-02-09 Thread Dennis via Digitalmars-d-learn
On Friday, 9 February 2018 at 18:14:06 UTC, Mike Wey wrote: You may need to pass `/s` to implib so it will add the underscore to the symbol in the import library. If it's actually needed depends on what the dll uses. That did it, now both dynamic loading and dynamic linking work. :) Thanks

Re: Elegant way to use dynamic bindings

2018-02-09 Thread Mike Wey via Digitalmars-d-learn
On 09-02-18 15:04, Dennis wrote: I read the Derelict documentation a while ago, I didn't grasp all of it. Reading it again, I can now make sense of it though. :) On Friday, 9 February 2018 at 12:53:44 UTC, Mike Parker wrote: Did you link with the library you created with implib? That linker

Re: Elegant way to use dynamic bindings

2018-02-09 Thread Dennis via Digitalmars-d-learn
On Friday, 9 February 2018 at 14:51:30 UTC, Mike Parker wrote: 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? (...) That depends. Is that the directory where your executable is written? Are you

Re: Elegant way to use dynamic bindings

2018-02-09 Thread Mike Parker via Digitalmars-d-learn
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

Re: Elegant way to use dynamic bindings

2018-02-09 Thread Dennis via Digitalmars-d-learn
I read the Derelict documentation a while ago, I didn't grasp all of it. Reading it again, I can now make sense of it though. :) On Friday, 9 February 2018 at 12:53:44 UTC, Mike Parker wrote: Did you link with the library you created with implib? That linker error suggests you didn't. I

Re: Elegant way to use dynamic bindings

2018-02-09 Thread Mike Parker via Digitalmars-d-learn
On Friday, 9 February 2018 at 12:15:04 UTC, Dennis wrote: I presume the .dll isn't loaded properly (if at all), but I can't find a load function in the .lib and don't know how to debug this. So I guess I'll just do it manually since that works, but does anyone have some tips to make .dll

Re: Elegant way to use dynamic bindings

2018-02-09 Thread Mike Parker via Digitalmars-d-learn
On Friday, 9 February 2018 at 12:15:04 UTC, Dennis wrote: I found the IMPLIB tool (http://www.digitalmars.com//ctg/implib.html) and made a .lib for the .dll and at first I got: Error 42: Symbol Undefined _CoreGetAPIVersions Error: linker exited with status 1 Forgot to address this in the