Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Create dll's to reduce code size??

Author
Message
old man
20
Years of Service
User Offline
Joined: 25th Feb 2004
Location:
Posted: 3rd Nov 2009 11:37
Hi

I have been playing around with a project that looks ok but it is growing like topsy,(getting too big!).

It occured to me that a lot of the code is not being used most of the time, I really only need the spine of the project loaded all time and then branch out as the user encounters a scenario, then back to the stem etc..

Would it be possible to have large chunks of Dark GDK in dll's?

I know nothing about writing a dll but before I embark on that learning curve I want to know if it is possible??

All thoughts welcomed!!

uff
Drowneath
15
Years of Service
User Offline
Joined: 22nd Jun 2009
Location: In your eyes
Posted: 3rd Nov 2009 14:43
What do you mean by "code size"?

Is it executable size, or the source code file size?

if(asleep) sheep++;
old man
20
Years of Service
User Offline
Joined: 25th Feb 2004
Location:
Posted: 3rd Nov 2009 14:54
Hi Drowneath

I meant the executable.

I know that the total code size would increase if I make what are now parts of the executable build into dll's, but I thought that it might be better to have only the parts that are being used actually running.

I could well be wrong, (I often am), but I think that it may be better practice??

Perhaps the operating system takes care of all that, (remember I am stuck in a 1970's time warp when things were more simple yet you needed to be more careful with resources).

uff
Drowneath
15
Years of Service
User Offline
Joined: 22nd Jun 2009
Location: In your eyes
Posted: 3rd Nov 2009 18:21 Edited at: 3rd Nov 2009 18:22
You can pack and reduce your executable size with UPX.

It's a console program, so you need to run it through the command line.
Use upx -9 name_of_your_exe_file.exe for maximum compression.

if(asleep) sheep++;
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 4th Nov 2009 21:56
Are you looking at the size of the executable from the debug compile? It would be noticably larger than the one for the release compile.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
old man
20
Years of Service
User Offline
Joined: 25th Feb 2004
Location:
Posted: 5th Nov 2009 10:33
Thanks Lilith

Yes I do understand about debug and release.

I really wanted to know if it is possible to do everything that you can do in the main prog in a dll?

Say you have two completely different "games" that work fine on their own, called A and B.

Now say you create another one that includes the code from both of the first two plus some more, called C.

Now C will of course have a larger exe file and so will use more resource on the computer.

C uses either the code from A OR the code from B, not both at the same time.

So My question is:

Is it possible to make A and B into dlls that get called by C as required?

I have not tried because I do not know how to create a dll, just wondering if it is worth learning?

uff
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 5th Nov 2009 15:35
regarding the final exe size "problem"...

if i make a game and i don't use the 2d libraries and the networking functions, will the relevant LIBs be linked to the final exe?
entomophobiac
21
Years of Service
User Offline
Joined: 1st Nov 2002
Location: United States
Posted: 6th Nov 2009 09:10
A DLL is just a different way to compile, as opposed to an EXE. I think it's more than possible, actually, I think it's quite a good idea if you find your project bloated.

Look it up in Visual Studio -- start a new project and choose to make a DLL. This WILL be a preprocessing/linking nightmare, but it's most likely possible.

(And I think everything that has to do with C++ is a preprocessing/linking nightmare...)

Login to post a reply

Server time is: 2024-10-01 16:37:21
Your offset time is: 2024-10-01 16:37:21