You are not logged in or registered. Please login or register to use the full functionality of this board...

 
Thread Rating:
  • 7 Votes - 2.43 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply 
Making a dll file from scratch to call externall classes and functions
» I need help to make a dll to access a graphics engine's classes :o)
01-27-2010, 06:41 PM
Post: #1
Tongue Making a dll file from scratch to call externall classes and functions
Hi!

I've been doing some studying on dll's for about a fortnight now. I have been understanding their concept well enough but have had alot of porblems understanding how to make them. Thanks to the tutorials on this site and the web in general I am not too bad with them now. I think I could probably make a small demo dll test project if I wanted.

My issue is this however:

I am trying to load a demo program for a graphics engine called OGRE. I am building from source, and I am enjoying learning how to. There are no pre-compiled things available for my IDE's compiler (Dev C++ IDE and MingW compiler) but this doesn't trouble me as I want to learn to build from source anyway. I can get my cpp file to compile without any errors in the code. I did have some issues with header files but I have told my IDE where to look for them now so that's ok. The problem is though the linker is complaining. The reason is there are loads and loads of c++ files in OGRE where all the main classes are defined and when my project tries to compile it says it cannot find any of them.

I do not want to have to attach every required OGRE c++ file to my project to get it to run. I am told this is where I need a DLL file. If I can make a DLL file which contains all the required OGRE programs then I only have to include that DLL file in my project - please correct me if I am wrong. So with all that explained I have the following questions:

1) By telling my IDE which C++ header files to include, does this mean a copy of all those header files is copied to my project when I compile it or do they stay at their location in memory and just get accessed when needed at run-time (would this cause a hard drive hit?) or when the .exe file is initiated?

2) Can I make a DLL file without having to explicity copy and paste all the required (several hundred) OGRE class defines into it. Is there some way I can just use a DLL as a sort of reference, just as a 'go between' between my main c++ file and the required OGRE c++ files with the classes in them?

3) Do I have to use a DLL in the fashion where it is accessed at run time or can I use one to make a static library? There will only ever be one instance of our demo application running so do we really need a DLL file to be shared and accessed at run time? Is there some perfomance benefit from using a DLL in this way?

I haven't really got a clue, but then I've never had it properly explained to me. Mostly it's just half truths with lots of information missing and people assuming I know stuff I've never been taught 001_unsure

This site seems different though, it appears to have quite a different attitude so perhaps this is the right place for a noob Biggrin

Thanks muchly to anyone who can help us 001_cool
Find all posts by this user
Quote this message in a reply
01-27-2010, 09:28 PM
Post: #2
RE: Making a dll file from scratch to call externall classes and functions
Don't try to compile something from scratch, you will always face more and more errors and it will just be too much work.

Instead download something like this:
Guests cannot see links in the messages. Please register to forum by clicking here to see links.

At the bottom there is a previous release for Code::Blocks + MingW, download Code::Blocks which works just like DevCpp except better (newer). Then use the project files there to compile ogre.

Trying to compile a DLL for that would be a lot of work and completely unnecessary.

If nothing is working, install Visual Studio and use the SDK download for Ogre.

[Image: adminexecuterh8.png]
☤ ☢ Software Engineer - Director of Inferno ☢ ☤
Visit this user's website Find all posts by this user
Quote this message in a reply
01-28-2010, 05:21 AM
Post: #3
RE: Making a dll file from scratch to call externall classes and functions
Thanks for the reply. You sold the idea to me, I will do exactly as you recommend cheers.

Purely for the sake of ending my curiousity though could anyone answer some of the questions above I would just simply love to know. I've become as interested in programming as I have in OGRE in general cheers 001_cool
Find all posts by this user
Quote this message in a reply
01-29-2010, 06:50 PM
Post: #4
RE: Making a dll file from scratch to call externall classes and functions
1) They get accessed... And they are compiled into .o files.
2) I think you do have to do all that work.
3) DLLs have performance benefits, they are only accessed INSIDE the main program to get certain functions without having it within the .exe file, saving memory, and only loading it if needed. LIBs are used when you want it to come together with the .exe.
Find all posts by this user
Quote this message in a reply
01-29-2010, 08:04 PM
Post: #5
RE: Making a dll file from scratch to call externall classes and functions
That's excellent Nicolas, thanks for summing all that up for me cheers pal Biggrin
Find all posts by this user
Quote this message in a reply
Post Reply