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

Derelict in a Nutshell

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



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

PostPosted: Thu May 06, 2004 11:48 pm    Post subject: Derelict in a Nutshell Reply with quote

This little project is an effort to collate several modules which interface with various multimedia-related libraries. Each package will be self contained, eliminating the need for import lib dependencies - all shared libraries will be loaded dynamically by the modules. Some time ago I adopted the habit of never linking an import lib with the main executable of any of my projects, thanks in no small part to the oh-so-helpful error message Windows displays when the user is missing a required DLL. Nearly every D port I've seen of existing C libs require linking with the import lib. So if it seems like I'm reinventing stuff, now you know why.

The first three packages on my hit list are, in order:
opengl
DirectInput (DX5 flavor)
openal

The opengl package is complete up to gl 1.5, and I am currently working on the extensions. After those 3 are put together, I'll be moving on to other things. What I'm looking at right now (in no particular order): dx5 ~ 9, libpng, libjpeg, libogg, and libvorbis. Beyond that, I'm open to including just about anything (as long as it's multimedia [read: games] related). But what I have defined here is what I will consider a 1.0 release.

Because I'm doing all of this by hand, I'm bound to overlook a function here or there (ogl is so friggin big). I'll happily accept help from anyone willing to put these ports through their paces and making those obscure function calls that most of us don't make. Also, I'm on the lookout for those who know their way around Linux (and eventually Mac when D arrives there) better than I to handle version(Linux) on those modules which apply. I'm abstracting the LoadLibrary calls, so the Linux ports will be minimal effort. Anyone interested please give a shout.

I hope that a) you find this useful and b) I find time to actually start the project which spawned all of this Smile
Back to top
View user's profile Send private message Send e-mail
JJR



Joined: 22 Feb 2004
Posts: 1104

PostPosted: Fri May 07, 2004 12:37 am    Post subject: Reply with quote

The project is an excellent idea! Thank you for starting it.

But... the name's connotation is very unfitting! Are you planning on abandoning the project? Wink
Back to top
View user's profile Send private message
larsivi
Site Admin


Joined: 27 Mar 2004
Posts: 453
Location: Trondheim, Norway

PostPosted: Fri May 07, 2004 2:26 am    Post subject: Reply with quote

May I suggest DevIL (www.imagelib.org)? It may not be basic enough, though.
Back to top
View user's profile Send private message
aldacron



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

PostPosted: Fri May 07, 2004 9:48 am    Post subject: Reply with quote

JJR wrote:
The project is an excellent idea! Thank you for starting it.

But... the name's connotation is very unfitting! Are you planning on abandoning the project? Wink


Thanks. And I assure you, the name of the project fits me to a T Wink

larsivi wrote:

May I suggest DevIL (www.imagelib.org)? It may not be basic enough, though.


Actually, DevIL is something I am looking at including down the road. I want to build up a stable base of low level libs, then I'll start looking at midlevel stuff such as DevIL, the SDL* libs, etc...
Back to top
View user's profile Send private message Send e-mail
l8night



Joined: 03 May 2004
Posts: 32
Location: UK

PostPosted: Fri May 07, 2004 2:58 pm    Post subject: Explicit linking Reply with quote

a bit of an aside; Good see another fan of explicit linking, I would be interested in you view of my dynloader templated lib (within util8) on http://www.geocities.com/one_mad_alien/dcode/index.html
the core32 lib has the dx8 (and soon dx9) bits without DirectInput, but I have C code to explicitly get most of it (there are issues with some of the structs that are loaded from dlls) so may have some code for you so coerce into you lib sometime this month.
I've been thinking of porting libpng or porting the 6legs java png classes
all depends on which happend first; I sober up, or I get a job!!
Back to top
View user's profile Send private message
aldacron



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

PostPosted: Fri May 07, 2004 5:07 pm    Post subject: Re: Explicit linking Reply with quote

l8night wrote:
a bit of an aside; Good see another fan of explicit linking, I would be interested in you view of my dynloader templated lib (within util8) on http://www.geocities.com/one_mad_alien/dcode/index.html


My first thought is "Man, that's a lot of code to load a library!" Wink But glancing through that and DFC, I see it's a great deal more compact than:

Code:

alias void function(GLenum) pfglClear;
...

pfglClear glClear;
...

glClear = (pfglClear)getProc("glClear")


Just think of all the typing I could have saved!

Seriously though, on the surface it looks like an excellent idea. I never would have thought of it. I know Matthew's loader is (eventually) supposed to get dropped into Phobos. Other than that, I know zero about his implementation. When it does get added, will you be dropping yours in favor of his?

l8night wrote:

the core32 lib has the dx8 (and soon dx9) bits without DirectInput, but I have C code to explicitly get most of it (there are issues with some of the structs that are loaded from dlls) so may have some code for you so coerce into you lib sometime this month.


That would be excellent. And I know what you're talking about with DInput (the c_diFormat stuff, or whatever it's called.. been a while since I worked with DI directly). There's actually a way around that without resorting to C and (I assume you are) linking with DI. You can define your own device formats rather than using the constants provided by DI. It's a b**h figuring out what the struct member values should be since the docs give you no idea, but the SDL folks managed to come up something workable. Take a look at the SDL source to get an idea. It's probably okay to copy it verbatim without worrying about the license (as long as you verify with Sam) as I don't believe it's original SDL code.
Back to top
View user's profile Send private message Send e-mail
aldacron



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

PostPosted: Fri May 07, 2004 5:50 pm    Post subject: Re: Explicit linking Reply with quote

aldacron wrote:

Seriously though, on the surface it looks like an excellent idea. I never would have thought of it. I know Matthew's loader is (eventually) supposed to get dropped into Phobos. Other than that, I know zero about his implementation. When it does get added, will you be dropping yours in favor of his?


After posting the above I saw Matthew's implementation posted on the NG. Now I see it's not something that would replace yours.
Back to top
View user's profile Send private message Send e-mail
l8night



Joined: 03 May 2004
Posts: 32
Location: UK

PostPosted: Fri May 07, 2004 6:07 pm    Post subject: Reply with quote

dynloader:
I'm not going to be using loader.d, I wrote my code to solve a problem, that of being able to use timeGetTime from winmm.dll without having to resort to changing the code that called timeGetTime or making an import lib for winmm.dll.
the majority of the code is redundant unless you use it, it stems from the lack of varargs in templates, so T function(P) need a template as does T function (P0, P1 ) as does T function( p0, P1, ..., Pn ) ad nausium.
then there is a linking issue for each linkage type you need a template, hence the enum and the reproduction of the templates
and finally there are the structure with the over loaded opCall, a little slower (5?) but means you can import with 2 lines of code (only one needs the params), rather than 3 where one is an alias to the template.
FYI loader.d is in the phobos src dir already (0.86 and 0.8Cool

DInput:
yes it was all that c_diFormat stuff, in the end I gave in to the greater evil and used #pragma lib(...) [as it was VC6 not mingw] in my code (wipped myself with birch twigs, live on web-cam for a few minutes to cleanse my soul)
I will have a look at the SDL code tomorow after I find my dx9 bits
which I kind of shelved once I found that I could not get a HDC from a D3D9 texture (or could not work out how to do it) and all the VC examples use the DXEX (i think that right) lib which is a static lib (or seemed to be) thus no good for a D project. [trying to render a bitmap onto a texture, openGL was easy (er)]

Mike.
Back to top
View user's profile Send private message
aldacron



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

PostPosted: Fri May 07, 2004 7:32 pm    Post subject: Reply with quote

l8night wrote:
dynloader:
and finally there are the structure with the over loaded opCall, a little slower (5?)


After looking deeper into the code that was something I was wondering about. I didn't realize it would be that much of a hit though.

And whaddaya know, there's loader.d. I need to look in that phobos dir more often.
Back to top
View user's profile Send private message Send e-mail
Hohums



Joined: 08 Apr 2004
Posts: 71
Location: Western Australia

PostPosted: Fri May 07, 2004 11:32 pm    Post subject: Reply with quote

This sounds good. May I suggest me glee port for openGL extentions.

http://badmama.com.au/~anderson/
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
aldacron



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

PostPosted: Sat May 08, 2004 6:06 am    Post subject: Reply with quote

Hohums wrote:
This sounds good. May I suggest me glee port for openGL extentions.

http://badmama.com.au/~anderson/


Ugh, I really am taking the road more traveled. I hate duplicating effort, but the thing that prevents me from using that is the fact that it requires GLee. I want to keep each Derelict package as self contained as possible, with Phobos being the only dependency (unless there's absolutely no choice). Otherwise I'd be using Pavel's GL stuff with your GLee Smile. In fact, don't be surprised in the future to see me reimplementing some open source C libraries completely in D (not neccesarily as part of Derelict).

One thing I'm really hoping to do along those lines is taking a scripting language like Lua or Small (not Python, it's too damn big), and reimplementing it in D in a way such that the scripting language is completely integrated. D object would be script objects, scripts could import D modules, and so on. That would eliminate the need to set up all of the glue code for each project. Sort of like what pnut and BeanShell do with Java.

D is like a big playground for me since it's still so new and there are very few libraries available for it. I see it as a good time doing complete ports of C code Smile If I get too carried away though I'll never get my real project done!
Back to top
View user's profile Send private message Send e-mail
Hohums



Joined: 08 Apr 2004
Posts: 71
Location: Western Australia

PostPosted: Sat May 08, 2004 8:34 am    Post subject: Reply with quote

aldacron wrote:
Hohums wrote:
This sounds good. May I suggest me glee port for openGL extentions.

http://badmama.com.au/~anderson/


Ugh, I really am taking the road more traveled. I hate duplicating effort, but the thing that prevents me from using that is the fact that it requires GLee. I want to keep each Derelict package as self contained as possible, with Phobos being the only dependency (unless there's absolutely no choice). Otherwise I'd be using Pavel's GL stuff with your GLee Smile.


Fair enough. I guess people can still use GLee with of Derelict, as long as there are no name clashes.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
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