www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Watch me beat a dead horse. Super simple program...

reply WhatMeWorry <kheaser gmail.com> writes:
Ok, I've gotten rid of dub and dub packages code. Just 
LoadLibraryA. All eight dlls work except for FreeImage.dll. I've 
compiled with dmd and -m64 option and freshly download a x64 
FreeImage. Any Window users out there that use LoadLibraryA or 
FreeImage.dll?

```
import std.stdio: writeln;
import std.string: toStringz;
import core.sys.windows.windows: LoadLibraryA;

void main()
{
     string[] DLLs = [ "assimp.dll", "fmod.dll", "freetype.dll", 
"glfw3.dll",
                       "OpenAL32.dll", "SDL2.dll", 
"SDL2_mixer.dll", "FreeImage.dll" ];
	
     foreach(dll; DLLs)
     {
         void *ptr = LoadLibraryA(toStringz(dll));
         if (ptr)
             writeln("calling LoadLibraryA with ", dll, " ptr is 
set");
         else
             writeln("calling LoadLibraryA with ", dll, " ptr is 
NULL");		
     }
}
```	
	
C:\Users\Admin\Documents\GitHub\Delivery\apps\00_03_freeimage_debug>app.exe
calling LoadLibraryA with assimp.dll ptr is set
calling LoadLibraryA with fmod.dll ptr is set
calling LoadLibraryA with freetype.dll ptr is set
calling LoadLibraryA with glfw3.dll ptr is set
calling LoadLibraryA with OpenAL32.dll ptr is set
calling LoadLibraryA with SDL2.dll ptr is set
calling LoadLibraryA with SDL2_mixer.dll ptr is set
calling LoadLibraryA with FreeImage.dll ptr is NULL
	
	
C:\Users\Admin\Documents\GitHub\Delivery\apps\00_03_freeimage_debug>dir

03/22/2023  01:45 PM             3,116 app.d
03/22/2023  01:46 PM           681,984 app.exe

03/06/2023  04:25 PM         3,805,184 assimp.dll
03/06/2023  04:25 PM         1,721,344 fmod.dll
03/06/2023  04:25 PM         6,942,208 FreeImage.dll
03/06/2023  04:25 PM           832,512 freetype.dll
03/06/2023  04:25 PM           216,576 glfw3.dll
03/06/2023  04:25 PM           122,904 OpenAL32.dll
03/06/2023  04:25 PM         1,220,096 SDL2.dll
03/06/2023  04:25 PM           143,872 SDL2_mixer.dll
Mar 22 2023
next sibling parent ryuukk_ <ryuukk.dev gmail.com> writes:
On Wednesday, 22 March 2023 at 19:33:45 UTC, WhatMeWorry wrote:
 Ok, I've gotten rid of dub and dub packages code. Just 
 LoadLibraryA. All eight dlls work except for FreeImage.dll. 
 I've compiled with dmd and -m64 option and freshly download a 
 x64 FreeImage. Any Window users out there that use LoadLibraryA 
 or FreeImage.dll?

 ```
 import std.stdio: writeln;
 import std.string: toStringz;
 import core.sys.windows.windows: LoadLibraryA;

 void main()
 {
     string[] DLLs = [ "assimp.dll", "fmod.dll", "freetype.dll", 
 "glfw3.dll",
                       "OpenAL32.dll", "SDL2.dll", 
 "SDL2_mixer.dll", "FreeImage.dll" ];
 	
     foreach(dll; DLLs)
     {
         void *ptr = LoadLibraryA(toStringz(dll));
         if (ptr)
             writeln("calling LoadLibraryA with ", dll, " ptr is 
 set");
         else
             writeln("calling LoadLibraryA with ", dll, " ptr is 
 NULL");		
     }
 }
 ```	
 	
 C:\Users\Admin\Documents\GitHub\Delivery\apps\00_03_freeimage_debug>app.exe
 calling LoadLibraryA with assimp.dll ptr is set
 calling LoadLibraryA with fmod.dll ptr is set
 calling LoadLibraryA with freetype.dll ptr is set
 calling LoadLibraryA with glfw3.dll ptr is set
 calling LoadLibraryA with OpenAL32.dll ptr is set
 calling LoadLibraryA with SDL2.dll ptr is set
 calling LoadLibraryA with SDL2_mixer.dll ptr is set
 calling LoadLibraryA with FreeImage.dll ptr is NULL
 	
 	
 C:\Users\Admin\Documents\GitHub\Delivery\apps\00_03_freeimage_debug>dir

 03/22/2023  01:45 PM             3,116 app.d
 03/22/2023  01:46 PM           681,984 app.exe

 03/06/2023  04:25 PM         3,805,184 assimp.dll
 03/06/2023  04:25 PM         1,721,344 fmod.dll
 03/06/2023  04:25 PM         6,942,208 FreeImage.dll
 03/06/2023  04:25 PM           832,512 freetype.dll
 03/06/2023  04:25 PM           216,576 glfw3.dll
 03/06/2023  04:25 PM           122,904 OpenAL32.dll
 03/06/2023  04:25 PM         1,220,096 SDL2.dll
 03/06/2023  04:25 PM           143,872 SDL2_mixer.dll
Most likely a dependency that is missing? Can you zip your folder and upload it somewhere so i could try help you debug this issue?
Mar 22 2023
prev sibling parent reply "Richard (Rikki) Andrew Cattermole" <richard cattermole.co.nz> writes:
I finally went ahead and looked at the dependencies of FreeImage3180.

Try installing: 
https://www.microsoft.com/en-ca/download/details.aspx?id=48145

It requires VCOMP140.dll which comes with the 2015 VC redistribution 
package.

Found via: https://github.com/lucasg/Dependencies
Mar 22 2023
parent reply WhatMeWorry <kheaser gmail.com> writes:
On Wednesday, 22 March 2023 at 21:08:23 UTC, Richard (Rikki) 
Andrew Cattermole wrote:
 I finally went ahead and looked at the dependencies of 
 FreeImage3180.

 Try installing: 
 https://www.microsoft.com/en-ca/download/details.aspx?id=48145

 It requires VCOMP140.dll which comes with the 2015 VC 
 redistribution package.

 Found via: https://github.com/lucasg/Dependencies
Yes! Thank you very much. Downloaded the 2015 Microsoft Visual C++ Redistributables and it worked. You mentioning "dependencies" in an earlier post, but didn't know how to proceed. Would it be worth while to update the bindbc-FreeImage documentation or is this common knowledge?
Mar 22 2023
parent "Richard (Rikki) Andrew Cattermole" <richard cattermole.co.nz> writes:
On 23/03/2023 12:28 PM, WhatMeWorry wrote:
 Yes! Thank you very much.  Downloaded the 2015 Microsoft Visual C++ 
 Redistributables and it worked.  You mentioning "dependencies" in an 
 earlier post, but didn't know how to proceed.
 
 Would it be worth while to update the bindbc-FreeImage documentation or 
 is this common knowledge?
That would be the most likely solution to be do-able. But this really needs to be on FreeImage's site. It also appears the README in the distribution is out of date. Since its talking about Mingw for building. But Mingw supports MSVC for building and what version of MSVC installed matters.
Mar 22 2023