Click here to Skip to main content
15,887,083 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to get value Pin
Vaclav_5-May-18 4:41
Vaclav_5-May-18 4:41 
AnswerRe: How to get value Pin
Richard MacCutchan5-May-18 5:47
mveRichard MacCutchan5-May-18 5:47 
GeneralRe: How to get value Pin
Vaclav_6-May-18 3:54
Vaclav_6-May-18 3:54 
GeneralRe: How to get value Pin
Richard MacCutchan6-May-18 4:48
mveRichard MacCutchan6-May-18 4:48 
GeneralRe: How to get value Pin
Vaclav_6-May-18 6:49
Vaclav_6-May-18 6:49 
QuestionWrapping c++ Pin
Member 129991324-May-18 22:48
Member 129991324-May-18 22:48 
AnswerRe: Wrapping c++ Pin
Richard MacCutchan5-May-18 1:26
mveRichard MacCutchan5-May-18 1:26 
GeneralRe: Wrapping c++ Pin
Member 129991325-May-18 5:06
Member 129991325-May-18 5:06 
Hi richard thanks for the reply
obj->funcref(&h,&b); I know this wont work, don't know why I even typed it.
Any way here goes

file.cpp

//------------
// CONSTRUCTOR
//------------
Test::Test()
{
}

//-----------
// DESTRUCTOR
//-----------
Test::~Test()
{
}


HRESULT Test::funcref(int &h, BSTR &b )
{
HRESULT hr = S_OK
char cstr[200];
strcpy_s(cstr, "BLAHHHHH");
*b = A2BSTR(cstr);
return hr;
}

HRESULT Test::funcp(int i,int *y)
{
HRESULT hr = S_OK
*y = i +7;
return hr;
}

file.h
class Test
{
public:
Test();
virtual ~Test();

static HRESULT funcref( int &h,BSTR &b);
static HRESULT funcp(int i, int *y);

};



wrapit.cpp

struct wrapStruct
{
void *obj;

};


extern "C" __declspec(dllexport) wrap_t *wrap_create()
{
wrap_t *m;
Test*obj;

m = static_cast(malloc(sizeof(*m)));

obj= new Test();
m->obj = obj;

return t;
}
extern "C" __declspec(dllexport) void wrap_destroy(wrap_t *m)
{

if (m == NULL)
return;
delete static_cast(m->obj);
free(m);
}

extern "C" __declspec(dllexport) int wrap_funcp(wrapper_L2H *m,int i,int* y)
{
Test *obj;
if (m == NULL)
return false;
obj= static_cast(m->obj);
obj->funcp(i, y);
return true;
}

extern "C" wrapper_API void wrap_funcref(wrap_t *m, int* h,BSTR* b) //?
{
Test *obj;
if (m == NULL)
return false;
obj = static_cast(m->obj);
obj->funcref(h, b);
return true;
}


wrapit.h

#ifdef WRAPPER_EXPORTS
#define wrapper_API __declspec(dllexport)
#else
#define wrapper_API __declspec(dllimport)
#endif

struct wrapStruct;

typedef struct wrapStruct wrap_t

extern "C" wrapper_API wrap_t* wrap__create();

extern "C" wrapper_API void wrap__destroy(wrap_t *m);

extern "C" wrapper_API void wrap_funcref(wrap_t *m, int *h, BSTR* b); //?
extern "C" wrapper_API void wrap_funcp(wrap_t *m, int *y;



useit.c

#include "wrapit.h"

int z=0,uu=0,d=0,p=0;

BSTR uu,nn;
wrap_t *z = wrap_create();

wrap_funcref(&p,&nn); //not sure does not work
wrap_funcp(z,&uu); //works

wrap_destroy(z);

wrap_funcp works
wrap_funcref does not.
GeneralRe: Wrapping c++ Pin
Richard MacCutchan5-May-18 5:42
mveRichard MacCutchan5-May-18 5:42 
QuestionMessage Closed Pin
2-May-18 23:33
Lapmangfpt2-May-18 23:33 
AnswerRe: help: list<struct> of list<string> Pin
Victor Nijegorodov2-May-18 23:57
Victor Nijegorodov2-May-18 23:57 
QuestionThe Breakpoint will not be hit the Source Code is different then the orignal Pin
ForNow30-Apr-18 16:08
ForNow30-Apr-18 16:08 
AnswerRe: The Breakpoint will not be hit the Source Code is different then the orignal Pin
Richard MacCutchan30-Apr-18 21:32
mveRichard MacCutchan30-Apr-18 21:32 
GeneralRe: The Breakpoint will not be hit the Source Code is different then the orignal Pin
ForNow1-May-18 15:53
ForNow1-May-18 15:53 
QuestionWhat are the best mocking frameworks available on Linux? Pin
Hila Berger29-Apr-18 2:13
Hila Berger29-Apr-18 2:13 
JokeRe: What are the best mocking frameworks available on Linux? Pin
Randor 29-Apr-18 15:32
professional Randor 29-Apr-18 15:32 
AnswerRe: What are the best mocking frameworks available on Linux? Pin
leon de boer29-Apr-18 17:10
leon de boer29-Apr-18 17:10 
AnswerRe: What are the best mocking frameworks available on Linux? Pin
IlanGreen1-May-18 2:37
IlanGreen1-May-18 2:37 
GeneralRe: What are the best mocking frameworks available on Linux? Pin
Hila Berger13-May-18 0:49
Hila Berger13-May-18 0:49 
GeneralRe: What are the best mocking frameworks available on Linux? Pin
IlanGreen13-May-18 1:15
IlanGreen13-May-18 1:15 
GeneralRe: What are the best mocking frameworks available on Linux? Pin
Hila Berger14-May-18 20:38
Hila Berger14-May-18 20:38 
QuestionInvalid operands to binary expression Pin
Member 1380291228-Apr-18 7:03
Member 1380291228-Apr-18 7:03 
AnswerRe: Invalid operands to binary expression Pin
Richard MacCutchan28-Apr-18 22:18
mveRichard MacCutchan28-Apr-18 22:18 
GeneralRe: Invalid operands to binary expression Pin
Member 1380291229-Apr-18 10:21
Member 1380291229-Apr-18 10:21 
GeneralRe: Invalid operands to binary expression Pin
Richard MacCutchan29-Apr-18 21:02
mveRichard MacCutchan29-Apr-18 21:02 

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.