Solved

About DLL and Lib...

Posted on 2002-03-17
5
286 Views
Last Modified: 2013-11-20
I want to learn how to create a DLL and Lib file. Please any body guide fow to start.

Thanking You
Venu
0
Comment
Question by:vgopalji
5 Comments
 
LVL 2

Expert Comment

by:shilpa_Jb
ID: 6876055
Hi,
Just go through the MSDN help on DLL, i think u get the idea of to create DLL and lib.
Or make use of www.msdn.com
Hope that helps u.
_shilpa
0
 
LVL 1

Accepted Solution

by:
pkreddy earned 50 total points
ID: 6876158
Hi,
 Simplest is to start off by

1. Access App. Wizard from File/New... and choose project tab
2. Choose project type as 'MFC Appwizard(Dll)', this gives you some choice and you can accept defaults.
3. Next, open the '<your_project>.h' file in your project and key in a function declaration with standard naming convetion.
Ex. STDAPI FunAdd(int a, int b);
4. Open you '<your_project>.cpp' file and define the function as
STDAPI FunAdd(int a, int b)
{
 return (a + b);
}
5. Open you '<your_project>.def' file, this will be present in your source files. Under section Exports
Just type
 FunAdd   @1

Now compile your project, it will give you both '<your_project>.dll' and '<your_project>.lib' files.
by default

1. To access the function in the dll, create a sample project to test the dll. In the file where you want to access the dll function type.
STDAPI FunAdd(int a, int b);

 and then in any place where you want to use the function just make a call

int ret = FunAdd(2,3);

Now open ur project settings using Project/Settings... and in the link tab specify the complete path to '.lib' file you had created earlier in "Path to your lib file" in this fashion. Compile your source code.

Now put the dll where your app executable is and execute the app. you should be able to get desired results.

I am being fairly comprehensive in this and will only help to start off. To get a more complete understanding refer to MSDN or any standard books on dll. Also this is one approach of creating dll and if you want an ordinary dll without MFC try out 'Win32 Dynamic-Link library'.

bye
Pavan


0
 
LVL 1

Expert Comment

by:orange_juice
ID: 6880637
thank you pkreddy.... short but comprehensive enough
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 10431625
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: pkreddy {http:#6876158}

Please leave any comments here within the next four days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

AndyAinscow
EE Cleanup Volunteer
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video discusses moving either the default database or any database to a new volume.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now