Can't load FreeImage.dll with Windows

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Fri Mar 3 22:16:05 UTC 2023


I went ahead and tried to reproduce your setup (this worked).

Used FreeImage3180Win32Win64.zip and recent dmd & ldc.

```json
{
	"authors": [
		"alpha"
	],
	"copyright": "Copyright © 2023, alpha",
	"description": "A minimal D application.",
	"license": "proprietary",
	"name": "whatmeworryfreeimage",
     "dependencies": {
         "bindbc-freeimage": "~>1.0.2"
     },
     "versions": ["FI_318"]
}
```

```d
import std.stdio;
import bindbc.freeimage;

void main()
{
     FISupport ret = loadFreeImage("FreeImage/Dist/x64/FreeImage.dll");
     if(ret != fiSupport) {
         if(ret == FISupport.noLibrary) {
             writeln("no");
         }
         else if(FISupport.badLibrary) {
             writeln("bad");
         }
     } else {
         writeln("good");
     }
}
```

Directory layout:

```
.
├── dub.json
├── FreeImage
│   └── Dist
│       ├── x32
│       │   └── FreeImage.dll
│       └── x64
│           └── FreeImage.dll
└── source
     └── app.d
```


More information about the Digitalmars-d-learn mailing list