Using .lib and .dll in D applications

Mike Parker via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jun 21 18:40:47 PDT 2016


On Tuesday, 21 June 2016 at 23:59:54 UTC, moe wrote:
> I had some time to try it out and I finally got it to work. I 
> have only tried in windows so far but there was a pitfall in 
> windows. Your dll need a DllMain entry to compile. This was the 
> only thing that was missing from your information.

Right, I forgot about that. It's always optional in C and C++, 
but in D we need to use it to initialize the runtime.


> -- TestApp // all files for the app (separate project)
> ---- packages
> ------ DerelictUtil-master // contains the project for derelict
> ---- source
> ------ app.d // the app
> ---- dub.json // the project file for the app

This is not the way DerelictUtil, or any DUB package, is intended 
to be used when you use DUB to manage your project. You don't 
need to download it this way. You chould change your dependency 
in TestApp:


> 	"dependencies": {
> 		"derelict-util":  "version=~>2.0.6",

2.0.6 is the latest. The '~>' means >=2.0.6 && <2.1.0, so that if 
there is a 2.0.7 released, you can run 'dub upgrade' on your 
project and start using it. The same for 2.0.8, 2.0.9, 2.0.n...

Of course, if you have a reason for doing it that way, more power 
to you :)


More information about the Digitalmars-d-learn mailing list