Click here to Skip to main content
15,884,986 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
AnswerRe: Remove COM Objects from VC++ projects Pin
Richard MacCutchan3-Jun-13 21:01
mveRichard MacCutchan3-Jun-13 21:01 
GeneralRe: Remove COM Objects from VC++ projects Pin
Prashant Gupta 2413-Jun-13 22:39
Prashant Gupta 2413-Jun-13 22:39 
GeneralRe: Remove COM Objects from VC++ projects Pin
Richard MacCutchan3-Jun-13 22:51
mveRichard MacCutchan3-Jun-13 22:51 
GeneralRe: Remove COM Objects from VC++ projects Pin
Prashant Gupta 2413-Jun-13 23:30
Prashant Gupta 2413-Jun-13 23:30 
GeneralRe: Remove COM Objects from VC++ projects Pin
Richard MacCutchan3-Jun-13 23:43
mveRichard MacCutchan3-Jun-13 23:43 
AnswerRe: Remove COM Objects from VC++ projects Pin
Hrpreet singh6-Jun-13 0:36
Hrpreet singh6-Jun-13 0:36 
GeneralRe: Remove COM Objects from VC++ projects Pin
Prashant Gupta 2416-Jun-13 0:42
Prashant Gupta 2416-Jun-13 0:42 
Questionc++ exporting class variables Pin
bfis1081371-Jun-13 9:26
bfis1081371-Jun-13 9:26 
I am very very new to c++. I have been allowed lol to be a part of this c++ project. I am supposed to write a c++ dll that will export to c#. Anyways I am having trouble with class variables in functions that are exported. Could someone help me pleaser with this. Fyi we are using qt framework so that's why you see a few qt things. Basically it is crashing if I access a class variable which in this case is called testInt. this is not the actual code we are working with but it does duplicate the problem exactly as it occurs in the real code. The problem is my c# code crashes when the variable testInt is accessed but not if testInt2 is accessed.

header
C++
#ifndef QTDDLLTESTCLASSVARIABLE_H
#define QTDDLLTESTCLASSVARIABLE_H

#include "qtddlltestclassvariable_global.h"

class QTDDLLTESTCLASSVARIABLE_EXPORT qtdDllTestClassVariable
{
public:
	qtdDllTestClassVariable();
	~qtdDllTestClassVariable();
	void Test();
	int testInt;
private:

};

#endif // QTDDLLTESTCLASSVARIABLE_H


C++
#include "qtddlltestclassvariable.h"
#include <qDebug>

cpp file
qtdDllTestClassVariable::qtdDllTestClassVariable()
{

}

qtdDllTestClassVariable::~qtdDllTestClassVariable()
{

}

void qtdDllTestClassVariable::Test()
{
	qDebug() << "started";
	testInt = 5;
	int testInt2 = 5;
        qDebug() << testInt << " after int";
	qDebug() << testInt2 << " after int2";
}



c# code

C#
[DllImport(@"..\..\..\Win32\Debug\qtdDllTestClassVariable.dll", CharSet = CharSet.Unicode, EntryPoint = "?Test@qtdDllTestClassVariable@@QAEXXZ")]
        public static extern void Test();


modified 1-Jun-13 15:51pm.

AnswerRe: c++ exporting class variables Pin
MicroVirus3-Jun-13 5:10
MicroVirus3-Jun-13 5:10 
QuestionHow to encrypt and decrypt a const char* in winrt Pin
yourchandrashekhar@gmail.com26-May-13 22:09
yourchandrashekhar@gmail.com26-May-13 22:09 
GeneralRe: How to encrypt and decrypt a const char* in winrt Pin
Richard MacCutchan26-May-13 23:36
mveRichard MacCutchan26-May-13 23:36 
GeneralRe: How to encrypt and decrypt a const char* in winrt Pin
yourchandrashekhar@gmail.com28-May-13 9:46
yourchandrashekhar@gmail.com28-May-13 9:46 
GeneralRe: How to encrypt and decrypt a const char* in winrt Pin
Richard MacCutchan28-May-13 11:21
mveRichard MacCutchan28-May-13 11:21 
QuestionVC++ Crashing? Pin
macklinbob20-May-13 9:25
macklinbob20-May-13 9:25 
AnswerRe: VC++ Crashing? Pin
chaau5-Jun-13 15:23
chaau5-Jun-13 15:23 
QuestionSuggestion for project type Pin
bkelly1319-May-13 15:55
bkelly1319-May-13 15:55 
AnswerRe: Suggestion for project type Pin
Garth J Lancaster19-May-13 17:49
professionalGarth J Lancaster19-May-13 17:49 
GeneralRe: Suggestion for project type Pin
bkelly1320-May-13 15:17
bkelly1320-May-13 15:17 
GeneralRe: Suggestion for project type Pin
Garth J Lancaster20-May-13 15:26
professionalGarth J Lancaster20-May-13 15:26 
GeneralRe: Suggestion for project type Pin
bkelly1320-May-13 15:54
bkelly1320-May-13 15:54 
GeneralRe: Suggestion for project type Pin
Garth J Lancaster20-May-13 16:01
professionalGarth J Lancaster20-May-13 16:01 
GeneralRe: Suggestion for project type Pin
bkelly1320-May-13 16:12
bkelly1320-May-13 16:12 
GeneralRe: Suggestion for project type Pin
Garth J Lancaster20-May-13 16:20
professionalGarth J Lancaster20-May-13 16:20 
GeneralRe: Suggestion for project type Pin
bkelly1320-May-13 16:27
bkelly1320-May-13 16:27 
GeneralRe: Suggestion for project type Pin
Garth J Lancaster20-May-13 16:32
professionalGarth J Lancaster20-May-13 16: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.