Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Aug 31st, 2004, 12:37 PM   #1
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Basically, what I want to do is create a load of functions in C++, compile them into a DLL and create a header file that sorts it all out for the user, without having a gazillion different .H files in the Include folder. Unfortunately, I have no clue how to do this. I'm using Visual Studio .NET at the mo, but I don't mind using something else if it'll help.

Anyone with half a brain that can explain all this to me?

-- Oobs.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Aug 31st, 2004, 12:42 PM   #2
Kylixen
Programmer
 
Kylixen's Avatar
 
Join Date: Jun 2004
Location: SC
Posts: 60
Rep Power: 5 Kylixen is on a distinguished road
Send a message via AIM to Kylixen Send a message via MSN to Kylixen
You could release it as a set of libraries, or you could include them with each project you do.

Make the DLL and the header file, and then just include them like you would normal libraries with your project and distribute them with your software.

Oh, when you create a project you have the option of making it a DLL.
__________________
ALLOW IMAGES IN SIGNATURES NOW
Kylixen is offline   Reply With Quote
Old Aug 31st, 2004, 12:52 PM   #3
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
That's what I plan to do. The question is, how? I think I know how to build a DLL in VS (I'll check it out later and post back), but how do I link to functions in the header file?
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Aug 31st, 2004, 12:54 PM   #4
Kylixen
Programmer
 
Kylixen's Avatar
 
Join Date: Jun 2004
Location: SC
Posts: 60
Rep Power: 5 Kylixen is on a distinguished road
Send a message via AIM to Kylixen Send a message via MSN to Kylixen
Quote:
Originally posted by Ooble@Aug 31 2004, 04:52 PM
That's what I plan to do. The question is, how? I think I know how to build a DLL in VS (I'll check it out later and post back), but how do I link to functions in the header file?
Hrm, try just prototyping them in the header file. I'll try with a shared object in linux and c what the results are.
__________________
ALLOW IMAGES IN SIGNATURES NOW
Kylixen is offline   Reply With Quote
Old Aug 31st, 2004, 1:13 PM   #5
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
I'm pretty sure you need to specify the DLL - at least, you do in VB. And I'm not sure how it would work without it. There must be some way to do it. I've found this guide, but I'm not sure how to apply this to what I want to do - create a couple of libraries that all my apps can use.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Aug 31st, 2004, 5:45 PM   #6
kurifu
Expert Programmer
 
kurifu's Avatar
 
Join Date: Jul 2004
Location: Halifax, Nova Scotia (Canada)
Posts: 784
Rep Power: 5 kurifu is on a distinguished road
Send a message via ICQ to kurifu Send a message via MSN to kurifu
There are several options for this, the easiest is probably to use the create a new DLL project with MSVC and let it works is magic, all you have to do is include the .H file in which you have exported your API and link the proper libraries with it.

Another solution, which may be better is to compile a DLL file (without generating a .lib file to go along with it), and than write a header file which exports code that will dynamically load the library via LoadLibrary( ), and provide an interface to each exported object in the DLL. Look up CMRLib on http://www.cliffordroche.com, there is a class in there MDLLProxy which pretty much does that, you can probably rip that template out into a single .H file (or even two .H files) and work with it.

Good luck.
__________________
Clifford Matthew Roche <geek@cliffordroche.com>
Web Hosting: http://www.crd-hosting.com
Consulting: http://www.crdev-consulting.com
kurifu is offline   Reply With Quote
Old Sep 1st, 2004, 5:31 AM   #7
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
So you're saying I can just write some functions, compile it as a DLL and load the stuff using LoadLibrary? Sounds easy enough, though no doubt it'll be harder in practice.

One more question - how can I create a class in that DLL and use it in my program? Is it even possible?
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:54 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC