Click here to Skip to main content
15,850,753 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Debug Assertion Failed error by WaitForMultipleObjectsEx in 64 bit application Pin
Randor 10-Nov-16 3:00
professional Randor 10-Nov-16 3:00 
GeneralRe: Debug Assertion Failed error by WaitForMultipleObjectsEx in 64 bit application Pin
Member 1233569510-Nov-16 23:44
Member 1233569510-Nov-16 23:44 
GeneralRe: Debug Assertion Failed error by WaitForMultipleObjectsEx in 64 bit application Pin
Member 1233569510-Nov-16 23:51
Member 1233569510-Nov-16 23:51 
AnswerRe: Debug Assertion Failed error by WaitForMultipleObjectsEx in 64 bit application Pin
Randor 11-Nov-16 5:06
professional Randor 11-Nov-16 5:06 
AnswerRe: Debug Assertion Failed error by WaitForMultipleObjectsEx in 64 bit application Pin
Albert Holguin10-Nov-16 8:36
professionalAlbert Holguin10-Nov-16 8:36 
QuestionHow to design pure C style APIs for a framework which include a core exe and plugin dlls Pin
bestbear9-Nov-16 20:59
bestbear9-Nov-16 20:59 
AnswerRe: How to design pure C style APIs for a framework which include a core exe and plugin dlls Pin
Richard MacCutchan9-Nov-16 23:52
mveRichard MacCutchan9-Nov-16 23:52 
AnswerRe: How to design pure C style APIs for a framework which include a core exe and plugin dlls Pin
leon de boer10-Nov-16 10:06
leon de boer10-Nov-16 10:06 
Just hold make an internal array of PCore pointers and pass them out an Index number ... call it a handle ... I guess a HPCORE.

So they hold onto an index number and when they call a function the pass in the index number and you grab back the PCore pointer out of your array.

That is what all the HANDLES are in Windows, they have a number it tells them nothing about what happens internally it just a index to a internal pointer that never comes out. So you code becomes more like Windows API and they can have multiple HPCore handles.

void main()
{
    HPCORE hPCore = CreateNewPCore();
    while(true){
       PCoreDoSomething(hPCore);	
     }
     DestroyPCore(hPCore);
}


EDIT: Actually I am being slow do what windows does exactly pass back a pointer to the position in the internal array rather than the index as the handle. First saves having to use the number to traverse the array to get the pointer (so much much faster). Second you can test the handle being valid if you need because it must lie between PCoreArray[0] ... PCoreArray[Last] of your internal PCore pointer array. It's index position in the array which you only need to know when you dispose to empty the slot is straight forward
Handle Index = (Handle - &PCoreArray[0])/sizeof(Pointer).

So a handle is a PCore** .. that is a pointer to a pointer to a PCore but I would just typedef it as size_t and internally typecast it because you can check it via the above. So ...
typedef size_t HPCORE;

In vino veritas


modified 10-Nov-16 21:33pm.

GeneralRe: How to design pure C style APIs for a framework which include a core exe and plugin dlls Pin
bestbear10-Nov-16 19:11
bestbear10-Nov-16 19:11 
QuestionC programming Determine Students grade Pin
Member 128422149-Nov-16 13:37
Member 128422149-Nov-16 13:37 
AnswerRe: C programming Determine Students grade Pin
leon de boer9-Nov-16 15:27
leon de boer9-Nov-16 15:27 
QuestionHow explicit , volatile and mutable keywords works INTERNALLY in C++ ? Pin
Amrit Agr6-Nov-16 23:06
Amrit Agr6-Nov-16 23:06 
AnswerRe: How explicit , volatile and mutable keywords works INTERNALLY in C++ ? Pin
Richard MacCutchan7-Nov-16 1:18
mveRichard MacCutchan7-Nov-16 1:18 
AnswerRe: How explicit , volatile and mutable keywords works INTERNALLY in C++ ? Pin
leon de boer7-Nov-16 9:15
leon de boer7-Nov-16 9:15 
GeneralPlease help Pin
Ahmed Adel5-Nov-16 4:20
Ahmed Adel5-Nov-16 4:20 
GeneralRe: Please help Pin
Richard MacCutchan5-Nov-16 22:01
mveRichard MacCutchan5-Nov-16 22:01 
GeneralRe: Please help Pin
leon de boer6-Nov-16 5:49
leon de boer6-Nov-16 5:49 
PraiseRe: Please help Pin
Ahmed Adel6-Nov-16 6:10
Ahmed Adel6-Nov-16 6:10 
QuestionPattern review C++: using structs with pure virtual methods in place of interfaces Pin
Member 128328324-Nov-16 6:58
Member 128328324-Nov-16 6:58 
AnswerRe: Pattern review C++: using structs with pure virtual methods in place of interfaces Pin
Chris Losinger4-Nov-16 9:23
professionalChris Losinger4-Nov-16 9:23 
AnswerRe: Pattern review C++: using structs with pure virtual methods in place of interfaces Pin
leon de boer4-Nov-16 9:48
leon de boer4-Nov-16 9:48 
AnswerRe: Pattern review C++: using structs with pure virtual methods in place of interfaces Pin
«_Superman_»5-Nov-16 22:42
professional«_Superman_»5-Nov-16 22:42 
AnswerRe: Pattern review C++: using structs with pure virtual methods in place of interfaces Pin
Daniel Pfeffer6-Nov-16 1:35
professionalDaniel Pfeffer6-Nov-16 1:35 
QuestionMouse out of dialog Pin
_Flaviu3-Nov-16 5:07
_Flaviu3-Nov-16 5:07 
AnswerRe: Mouse out of dialog Pin
leon de boer3-Nov-16 5:21
leon de boer3-Nov-16 5:21 

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.