Click here to Skip to main content
16,007,472 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: memory could not be "read" Pin
Joseph Marzbani3-Apr-08 10:00
Joseph Marzbani3-Apr-08 10:00 
GeneralRe: memory could not be "read" Pin
Mark Salsbery3-Apr-08 10:15
Mark Salsbery3-Apr-08 10:15 
GeneralRe: memory could not be "read" Pin
led mike3-Apr-08 10:42
led mike3-Apr-08 10:42 
GeneralRe: memory could not be "read" Pin
Mark Salsbery3-Apr-08 10:45
Mark Salsbery3-Apr-08 10:45 
GeneralDll and global variables. Pin
Dimitris Vikeloudas3-Apr-08 5:55
Dimitris Vikeloudas3-Apr-08 5:55 
GeneralRe: Dll and global variables. Pin
Joseph Marzbani3-Apr-08 6:03
Joseph Marzbani3-Apr-08 6:03 
GeneralRe: Dll and global variables. Pin
Dimitris Vikeloudas3-Apr-08 6:20
Dimitris Vikeloudas3-Apr-08 6:20 
AnswerRe: Dll and global variables. Pin
cyrfer9-Apr-08 15:49
cyrfer9-Apr-08 15:49 
Thus, how I create the g_iYourVariable initialise in one of source files of the first dll, use it in all other sources of the same dll, export it and be able to imported (assuming using __declspec(dllimport)) in any other dll file)?

1 - define a handy macro to make it easy for your DLL to use dllexport and allow clients to use dllimport. Put it in a file, call it "MyDLLExports.h".
#ifdef BUILDING_MYDLL<br />
#   define MyDLLExport __declspec(dllexport)<br />
#else<br />
#   define MyDLLExport __declspec(dllimport)<br />
#endif


2 - compile all sources of your DLL with the preprocessor definition 'BUILDING_MYDLL' added - when building only your DLL.


3 - define a header file where your variable will exist. e.g.
#ifndef __MyDLL_MyVar_h__<br />
#define __MyDLL_MyVar_h__<br />
<br />
#include "MyDLLExports.h"<br />
<br />
MyDLLExport int MyDLLmyVar;<br />
<br />
#endif // __MyDLL_MyVar_h__

GeneralRe: Dll and global variables. [modified] Pin
Dimitris Vikeloudas10-Apr-08 3:27
Dimitris Vikeloudas10-Apr-08 3:27 
GeneralRe: Dll and global variables. Pin
malaugh3-Apr-08 10:33
malaugh3-Apr-08 10:33 
GeneralRe: Dll and global variables. Pin
Dimitris Vikeloudas3-Apr-08 22:39
Dimitris Vikeloudas3-Apr-08 22:39 
GeneralCComPtr Pin
George_George3-Apr-08 4:47
George_George3-Apr-08 4:47 
GeneralRe: CComPtr Pin
led mike3-Apr-08 5:14
led mike3-Apr-08 5:14 
GeneralRe: CComPtr Pin
George_George3-Apr-08 21:16
George_George3-Apr-08 21:16 
GeneralA2WBSTR Pin
George_George3-Apr-08 4:40
George_George3-Apr-08 4:40 
GeneralRe: A2WBSTR Pin
James R. Twine3-Apr-08 4:54
James R. Twine3-Apr-08 4:54 
GeneralRe: A2WBSTR Pin
George_George3-Apr-08 21:29
George_George3-Apr-08 21:29 
GeneralRe: A2WBSTR Pin
CPallini3-Apr-08 5:47
mveCPallini3-Apr-08 5:47 
GeneralRe: A2WBSTR Pin
George_George3-Apr-08 21:27
George_George3-Apr-08 21:27 
GeneralRe: A2WBSTR Pin
CPallini3-Apr-08 22:38
mveCPallini3-Apr-08 22:38 
GeneralRe: A2WBSTR Pin
George_George3-Apr-08 23:04
George_George3-Apr-08 23:04 
GeneralRe: A2WBSTR Pin
CPallini3-Apr-08 23:15
mveCPallini3-Apr-08 23:15 
GeneralRe: A2WBSTR Pin
George_George3-Apr-08 23:18
George_George3-Apr-08 23:18 
GeneralRe: A2WBSTR Pin
CPallini3-Apr-08 23:29
mveCPallini3-Apr-08 23:29 
GeneralRe: A2WBSTR Pin
George_George3-Apr-08 23:32
George_George3-Apr-08 23:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.