Register for your free account! | Forgot your password?

Go Back   elitepvpers > Shooter > Soldier Front
You last visited: Today at 14:06

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



How To Make .dll File?

Discussion on How To Make .dll File? within the Soldier Front forum part of the Shooter category.

Closed Thread
 
Old   #1
 
oshigaki's Avatar
 
elite*gold: 0
Join Date: Jun 2009
Posts: 50
Received Thanks: 10
How To Make .dll File?

...Can Some Teach Me How To Make .dll FIle?
oshigaki is offline  
Old 11/29/2009, 15:06   #2
 
almar2023's Avatar
 
elite*gold: 0
Join Date: Oct 2008
Posts: 189
Received Thanks: 80
madali lag yan tol..,,

mag aral ka ng C++ ..

o kea mag aral ka ng programing..

medyo mahirap mag code kea good luck..!!
almar2023 is offline  
Thanks
1 User
Old 11/29/2009, 22:31   #3

 
.Walker's Avatar
 
elite*gold: 20
Join Date: Sep 2009
Posts: 5,799
Received Thanks: 2,790
~Question now answered
~Closing soon
.Walker is offline  
Old 12/07/2009, 21:45   #4
 
elite*gold: 44
Join Date: Sep 2008
Posts: 1,515
Received Thanks: 687
Here's a Tut for you, Hope you can get something out of it. ^^

1.It is assumed that you already created your class, so this step is bypassed.
2.First is the easy part. Start up �Microsoft Visual Studio Visual C++�. Select �File->New� to pull up the creation dialog. Under the �Projects� tab button, select �MFC AppWizard (DLL)�. Enter the project name and directory to be used then click �OK�. The rest of the options are not necessary, so select what you want to do in the rest of the Wizard and click �Finish�.
What typically happens after you started the new project is that a source code and header file has been created for you. These are not really needed if you already have the code you are going to build. Only the preset definitions for the project are needed from this step. It is suggested that you just empty the files created by highlighting and deleting the source and header files created by the Wizard. Do not edit the �StdAfx� files yet as these are needed.

The point in this step is to simply copy and paste your class (�foo�) into the header and source files created. It should be a simple concept to grasp, but if you are skeptical you can alternatively just add your �foo� source file and header file into the project so that it is built.

You will next begin the editing part. You must be able to make the build compile as a DLL file correctly for usage. DLL files use a combination of Exporting and Importing. When this is the build project you will need to �Export�. When it is being included in another project that does not use the source code, you will need to �Import�. This is probably the harder part of understanding the DLL as it is not necessarily implemented for you and requires a little effort before understanding. As a side note, the �resource.h� is only required by DLLs that have dialogs in them. In this case, you will have to remember that you may have several �resource.h� files then and will have to include a full path statement to each �resource.h� file. This article will show in the following example what is probably the best method (keeping in mind that if a project needs this resource file it must manually be added to the project including the full path to it).

3.Edit the �StdAfx.h� file and include the following MACROS and header file �resource.h�.

Code:
StdAfx.h
//
// MSVS included headers, definitions, etc.
//

// Somewhere near the bottom
//This is the project macro preprocessor definition 
//you will be adding shortly.
#ifdef DLL_EXPORTS
//This is to be used for the class header file.
#define DLL_BUILD_MACRO __declspec(dllexport)
#else
#define DLL_BUILD_MACRO __declspec(dllimport)
#endif

#ifndef _DLL_BUILD_ //Why do this? Is it necessary? Yes.
#define _DLL_BUILD_ DLL_BUILD_MACRO
#endif

//make sure resources are included here, if desired, 
//to prevent ambiguous
//callings to different resource.h files.
#include �resource.h�

//
// Rest of file
//
◦Next we go ahead and edit the main header file of your DLL code. Only a few simple lines need be added to support accurate DLL building and usage:

Code:
foo.h
#ifndef _FOO_H_
#define _FOO_H_

//
// Miscellanous here
//

/*This part automatically includes any libraries when called.
When this file is built within the DLL project, 
it will not be called because
of our preprocessor macro definition �_FOO_DLL_�.
However, when this file is called from another project, 
not part of this build,
it appropriately chooses the correct library and 
includes them for you.
WHAT this means is that you will not have to 
add the library to the project link settings
for a project that requires this DLL. This helps to 
avoid the tedious task of
linking to several custom DLLs.

Note there are two different libraries here and 
probably not necessary but give
you an idea of how to separate debug versions 
from release versions.*/

#ifndef _FOO_DLL_
#ifdef _DEBUG
//You will be building a debug program that 
//uses this file, so in this case we
//want the debug library.
#pragma comment( lib, �food.lib� ) 
#else
//You will be building a release program that
//uses this file, so in this case we
//want the release library.
#pragma comment( lib, �foo.lib� ) 
#endif
#endif
#ifndef _DLL_BUILD_
#define _DLL_BUILD_ //Makes sure there are no compiler errors.
#endif

class _DLL_BUILD_ foo
private:
//
// Your members
//
public:
//
// Your functions
//
};

#endif
◦To continue, edit the �foo.cpp� file and make sure you include the appropriate headers.

Code:
foo.cpp

#include �stdafx.h� //place first
#include �foo.h�

//
//Your code
//
◦This next step requires that you actually add the MACROS into the project settings. In the menu tool bar, go to �Project->Settings�� or press Alt+F7 alternatively. Click the �C/C++� tab. Under �Preprocessor definitions:� add the macro definitions �_FOO_DLL_� and �DLL_EXPORTS� at the end of the list of other macro definitions. Be sure to separate each new MACRO with a coma (�,�). Make sure to do this for the release version too, as you will have to redo these next steps for each type of build. Make sure to build with any �debug info� and/or �browse info� if this is a debug version and if you want to debug the DLL later using the MSVS debugger.
◦Next you will want to prepare for the last step. Go to the �Post-build step� tab under the same dialog. Under �Post-buid command(s):� click an empty space and enter �Debug.bat�. For the release version go to in the left pane and in the combo box �Settings For:� select �Win32 Release�. Enter like you did before in �Post-Build command(s)� but not �Debug.bat� and instead �Release.bat�. This is it for all the project settings.

6.Now to build the batch files. Create a blank file. You will be adding command line codes that will copy your files to a findable directory. The point here is that if you may have a ton of DLLs and it will be easier to have all the needed components in one directory. This is easier versus linking to several directories. Below are the suggestions used in this article that maybe you will want to consider for adding other options:

Code:
Debug.bat
Copy �Debug\foo.lib� �c:\<libraries dir>\food.lib�
REM copy the dll file to the windows system32 
REM directory to make the DLL easily
REM accessible.  Note that you will have to install or include the
REM dll file in your distribution package for the program that uses it.
Copy �Debug\foo.dll� �c:\%system dir%\system32�
Copy �foo.h� �c:\<headers dir>�

Release.bat
Copy �Release\foo.lib� �c:\<libraries dir>�
REM copy the dll file to the windows system32 directory 
REM to make the DLL easily accessible.
REM Note that you will have to install or include the dll 
REM file in your distribution package.
REM Unfortanetly this will overwrite any other DLL files 
REM such as the Release/Debug version,
REM so accurate update compilations are needed.  
REM You will have to note this yourself
REM before distributing to the public.
Copy �Release\foo.dll� �c:\%system dir%\system32�
Copy �foo.h� �c:\<headers dir>�
You are completely finished. Providing you have already pre-tested your class and considered where your library, header and DLL files are being copied you should receive no problems at all. Your class should be a DLL file that can be easily used in future projects without much work. All you have to do with this information is to know that you only need to include the header file and everything is done for you. Everything is made as easy and simple as possible for you on in out.


Notes

Some reminders are that the DLL file must be accessible. This article references using the �c:\windows\system32� directory. This may be a bad idea if you want to later retrieve that DLL file and must find it in the large collection of DLLs probably existing already in that directory. It can also be annoying if you later decide to change the name of the project and build under the different name. In that case you will have to find the old DLL file and manually remove it or just leave it there.

Alternatively you can copy the DLL file(s), library file(s) and header file(s) to the project directory that will be using it. However, if you decide to use the same DLL in another project you will have to go back and add a copy command line(s) in both the �Debug.bat� and �Release.bat� files and then rebuild the project to have them copied.

Also note that in MSVS it is easy to add custom directories for new header directories to search, but unfortunately not DLL directories. Go under �Tools->Options� in the menu bar and then under the �Directories� tab button. Where �<libraries dir>� above in the batch file should be included under �Library files� in the �Show directories for� combo box and �<headers dir>� in the �Include files�. Some MACROS may seem repetitive or not in use in this article. However, the compiler, when building, requires this type of style for both the DLL project and the project using that DLL. If you find that some are not needed you can remove them yourself. This code is designed so that they are there and readably Accessible. Testing shows that for both the DLL build and the project using that DLL build require these types of MACRO setups for usage. Other possibilities and locations exist.

Hope this helped you, Please Post with any questions i'd be glad to help ^^.

Sincerly,
Lion2205
Lion2205 is offline  
Thanks
1 User
Old 12/13/2009, 15:44   #5
 
elite*gold: 0
Join Date: Nov 2009
Posts: 602
Received Thanks: 777
Badly
Insolent[1]* is offline  
Thanks
1 User
Old 12/13/2009, 17:25   #6
 
lupin636's Avatar
 
elite*gold: 0
Join Date: Jul 2009
Posts: 501
Received Thanks: 336
@lion

thx for this tut man now i can make a dll now ^^

first i must learn c++
lupin636 is offline  
Old 12/13/2009, 19:12   #7
 
elite*gold: 25
Join Date: Apr 2009
Posts: 3,430
Received Thanks: 2,469
Closed

Answered Post.
†DARNOC† is offline  
Closed Thread


Similar Threads Similar Threads
How to make .div file to size 128 kb every file ?
02/08/2010 - Dekaron Private Server - 1 Replies
How to make .div file to size 128 kb every file ? i got div file from some where 500 file and every file size 128 kb how to make div file like that please guide . :)
can someone tell me how to make a .Ct file ?
02/07/2010 - Dekaron - 4 Replies
hello people i tried a lot but i dont know how to make a .CT file for running hacks,can someone tell me the way to make! It would be a great help to me.
Want To Make an ISO File of your own?
06/13/2009 - Soldier Front - 16 Replies
Magic ISO Maker Installer + Serial Link: Magic ISO Maker Press Thanks if i helped.
should i make an whs file for 90 dp?
10/29/2008 - Dekaron - 14 Replies
you guys want me to make whs files to hack the 90 dp?
How to make new ksm file ?
07/04/2008 - Kal Online - 1 Replies
So, i heard bakas ksm editor works XD i tested in temp and in d1 it worked and now my prob... if i got new map like this wannabe-emok i copy-paste 01-01 rename to 41-41 (or whatever) and make it like the map should have collisions but it dont work :O if i use a ksm with full collisions mobs dont spawn (its right cuz everywhere collision höhö löl xd) but if i make 1 fizzle pizzle point with no collision the map is "destroyed" everywhere spawn mobs :O so anyone can help me ?xD



All times are GMT +2. The time now is 14:06.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.