digitalmars.D.learn - Can't load FreeImage.dll with Windows
- WhatMeWorry (28/28) Mar 03 2023 I've tried distilling the problem to its very essence.
- ryuukk_ (2/2) Mar 03 2023 What happens if you put the dll next to your executable, does it
- WhatMeWorry (5/7) Mar 03 2023 Good idea. I copied the dll into same directory as the executable
- Richard (Rikki) Andrew Cattermole (48/48) Mar 03 2023 I went ahead and tried to reproduce your setup (this worked).
- Adam D Ruppe (2/3) Mar 03 2023 is your application build 64 bit too?
I've tried distilling the problem to its very essence. I downloaded the FreeImage.dll from https://freeimage.sourceforge.io/download.html to the following directory: where /R c:\ FreeImage.dll c:\Users\Admin\Downloads\FreeImage3180Win32Win64\FreeImage\Dist\x64\FreeImage.dll dir c:\Users\Admin\Downloads\FreeImage3180Win32Win64\FreeImage\Dist\x64\FreeImage.dll 07/31/2018 12:23 PM 6,942,208 FreeImage.dll 1 File(s) 6,942,208 bytes dependency "bindbc-freeimage" version="~>1.0.0" versions "FI_318" but when I try to load the dll with the bindbc-freeimage package provided loadFreeImage function, all I get is no library found: writeln("The dub.sdl file of this project expects FreeImage version ", fiSupport); immutable FISupport fiLib = loadFreeImage("c:\\Users\\Admin\\Downloads\\FreeImage3180Win32Win64\\FreeImage\\Dist\\x64\\FreeImage.dll"); writeln("loadFreeImage returned: ", fiLib); OUTPUT ------------------------------------------------------------------- The dub.sdl file of this project expects FreeImage version fi318 loadFreeImage returned: noLibrary I also tried: loadFreeImage(`c:\Users\Admin\Downloads\FreeImage3180Win32Win64\FreeImage\Dist\x64\FreeImage.dll`); and loadFreeImage(`c:/Users/Admin/Downloads/FreeImage3180Win32Win64/FreeImage/Dist/x64/FreeImage.dll`); but got same results. Also tried version="~>1.0.2"
Mar 03 2023
What happens if you put the dll next to your executable, does it find it?
Mar 03 2023
On Friday, 3 March 2023 at 19:44:17 UTC, ryuukk_ wrote:What happens if you put the dll next to your executable, does it find it?Good idea. I copied the dll into same directory as the executable and changed loadFreeImage to immutable FISupport fiLib = loadFreeImage(); And I get the same noLibrary result.
Mar 03 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
```
Mar 03 2023
On Friday, 3 March 2023 at 19:07:14 UTC, WhatMeWorry wrote:loadFreeImage(`c:\Users\Admin\Downloads\FreeImage3180Win32Win64\FreeImage\Dist\x64\FreeImage.dll`);is your application build 64 bit too?
Mar 03 2023









WhatMeWorry <kheaser gmail.com> 