Click here to Skip to main content
15,881,810 members
Articles / Programming Languages / C++

Need for Rebasing a DLL

Rate me:
Please Sign up or sign in to vote.
4.67/5 (44 votes)
29 May 2006CPOL6 min read 131.4K   981   70  
This article explains the need for rebasing a DLL.
// The following ifdef block is the standard way of creating macros which make exporting 
// from a DLL simpler. All files within this DLL are compiled with the DLL1_EXPORTS
// symbol defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see 
// DLL1_API functions as being imported from a DLL, wheras this DLL sees symbols
// defined with this macro as being exported.
#ifdef DLL1_EXPORTS
#define DLL1_API __declspec(dllexport)
#else
#define DLL1_API __declspec(dllimport)
#endif

// This class is exported from the Dll1.dll
class DLL1_API CDll1 {
public:
	CDll1(void);
	// TODO: add your methods here.
};

extern DLL1_API int nDll1;

DLL1_API int fnDll1(void);

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead
India India
Hi I am Sachin Sangoi from Mumbai. Working in VC++ from 9 years (From July 2004).Completed BE Electronics + PG CDAC + MBA Finance.
I would like to thanx Mr Sameer Vasani, my team and my friend Rahul bhamre from whom i learnt a lot.They have been a great help.
Thanx 2 all my friends especially Rahul B, Sandeep C, Sandeep K, Govind P, Rohit P, Pratik P who have all been there when needed.

Happy Coding Smile | :)

Comments and Discussions