FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DerelictSDLttf: dynamic .dll loading don't work

 
Post new topic   Reply to topic     Forum Index -> Derelict
View previous topic :: View next topic  
Author Message
mutable



Joined: 22 Jun 2010
Posts: 87

PostPosted: Thu Aug 04, 2011 10:14 am    Post subject: DerelictSDLttf: dynamic .dll loading don't work Reply with quote

First of all: sorry for my bad english.
Now the problem:
I would use the the manually dynamic loading with Derelict and tried to load the .dll files by passing them to the DerelicSDLttf.load call as string array parameters.
But I get this error
Quote:
derelict.util.exception.SymbolLoadException@derelict\util\exception.d(43): Faile
d to load symbol TTF_Linked_Version from shared library C:/D/dmd2/src/ext/Dgame/
config/dll/libfreetype-6.dll

Finally after a lot of searching and repleacing and downloading freetype and SDLttf dll's i found the Derelict CallBack Method, but i get for all TTF_* calls an error that they cannot found also, i think they cannot found becauce of the "da_" prefix that have all function bindings in the sdl.ttf file.
My question is: how can i fix it?
All other loadings works fine, i must only put the freetype.dll in the folder where the .exe file is now.

For the sake of completeness here is my code for loading the .dll files:
Code:

static this() {
   version (Windows) {
      string[] sdlFontLibs = [
         "C:/D/dmd2/src/ext/Dgame/config/dll/libfreetype-6.dll",
         "C:/D/dmd2/src/ext/Dgame/config/dll/SDL_ttf.dll"
      ];
      
      DerelictSDLttf.load(sdlFontLibs);
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Thu Aug 04, 2011 10:55 pm    Post subject: Reply with quote

The problem is this:

Code:

C:/D/dmd2/src/ext/Dgame/config/dll/libfreetype-6.dll


DerelictSDLttf does not know how to load FreeType. What's happening is it is sucessfully opening the FreeType dll, because that's what you told it to open first, but then it's looking for SDL_ttf functions. That's why it's failing.

The SDL_ttf dll is linked to FreeType and will load it automatically as long as it is on the system's DLL search path (it should be OK being in the same directory, I think). So you only need to tell Derelict where to find the SDL_ttf dll.
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail
mutable



Joined: 22 Jun 2010
Posts: 87

PostPosted: Fri Aug 05, 2011 3:20 am    Post subject: Reply with quote

Okay, so i must put freetype-6.dll in the same directory as the .exe.
But my intention was to load all dll files in the code. Then the end user must not add any dll files in his directory, where he programming which my framework.
Is there any alternative to load the freetype-6.dll? Or must the user add it manual?
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Fri Aug 05, 2011 3:52 am    Post subject: Reply with quote

mutable wrote:
Okay, so i must put freetype-6.dll in the same directory as the .exe.
But my intention was to load all dll files in the code. Then the end user must not add any dll files in his directory, where he programming which my framework.
Is there any alternative to load the freetype-6.dll? Or must the user add it manual?


If you want to use FreeType directly, you can use DerelictFT. But in this case, that isn't going to help you at all. There's no way for you to load freetype from some location and then tell SDL_ttf to use it without modifying SDL_ttf. SDL_ttf is still going to look for freetype on the default search path, whether it's loaded manually or automatically by the OS.
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail
mutable



Joined: 22 Jun 2010
Posts: 87

PostPosted: Fri Aug 05, 2011 5:58 am    Post subject: Reply with quote

Ok, all right. Thank you Smile
Back to top
View user's profile Send private message
mutable



Joined: 22 Jun 2010
Posts: 87

PostPosted: Sat Aug 13, 2011 3:36 am    Post subject: Reply with quote

Hi, me again. Short Question: how is the correct use of jpeg.dll and libpng.dll? Can i load both dynamical? If i try it, i earn an access violation error. If i put them manually in the .exe folder, it works correctly. But with zlib1.dll and freetype-6.dll there are 4 .dll files now, and my intention was, to reduce the required .dll files. So is there any way to load them dynamical too or is it the same problem as above with freetype-6.dll?
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Sat Aug 13, 2011 7:17 am    Post subject: Reply with quote

There are no bindings in Derelict for libjpeg or libpng, so Derelict doesn't know how to load them at all. And again, even if there were bindings for them, SDL_image (which I assume you are using) wouldn't be able to see the functions loaded from them if you *did* load them. This is not a problem, but is how shared libraries work. Just like one program can't see the variables declared in another, one program can't see the shared library symbols loaded by another. Each program has to get its own handle to the DLL and its own pointers to the functions. So for SDL_image to be able to load the DLLs it needs, they need to be on the DLL search path. The easiest way to do that is to put them in the application directory.

As for the number of DLLs, you can see this on the SDL_image project page:

Quote:

As of SDL_image 1.2.5, JPEG, PNG, and TIFF image loading libraries are dynamically loaded, so if you don't need to load those formats, you don't need to include those shared libraries. libpng depends on libz, and libtiff depends on both libz and libjpeg.


So if you don't need load PNG images, you can get rid of the libpng and zlib dlls. If you don't need JPEG images, you can get rid of the libjpeg DLL. As long as you use version 1.2.5 or later of SDL_image.
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Derelict All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group