Click here to Skip to main content
16,011,428 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralCString Pin
Gian17-Sep-02 0:01
Gian17-Sep-02 0:01 
GeneralRe: CString Pin
Gian17-Sep-02 0:05
Gian17-Sep-02 0:05 
GeneralRe: CString Pin
Alexandru Savescu17-Sep-02 1:57
Alexandru Savescu17-Sep-02 1:57 
GeneralRe: CString Pin
Gian17-Sep-02 3:12
Gian17-Sep-02 3:12 
GeneralUsing C++ code from C Pin
benjymous16-Sep-02 23:33
benjymous16-Sep-02 23:33 
GeneralRe: Using C++ code from C Pin
Alexandru Savescu17-Sep-02 3:25
Alexandru Savescu17-Sep-02 3:25 
GeneralRe: Using C++ code from C Pin
benjymous17-Sep-02 4:25
benjymous17-Sep-02 4:25 
GeneralRe: Using C++ code from C Pin
Paul M Watt17-Sep-02 6:21
mentorPaul M Watt17-Sep-02 6:21 
I think that your best bet will either to write COM object (which is a lot of work to use in C), or write a set of wrapper API functions that are exported from your DLL that will allow you to use your class from C.

These function will end up similar to the windows API, where you will create a function like CreateObject() that returns a handle to the new object pointer that you create.

Then when you call a member function you will pass in the handle to that object, and your DLL will translate the handle to the object and call the desired member function.

The reason that you cannot use a C++ class in C is because of the hidden this pointer that is included in all of the C++ class member functions. There are other ways to get around these problems, but I would really suggest one of my first to solutions.


Build a man a fire, and he will be warm for a day
Light a man on fire, and he will be warm for the rest of his life!

Questionhow to read mails from any server using VC++? Pin
Omar Lodhi16-Sep-02 23:33
Omar Lodhi16-Sep-02 23:33 
AnswerRe: how to read mails from any server using VC++? Pin
benjymous16-Sep-02 23:37
benjymous16-Sep-02 23:37 
GeneralRe: how to read mails from any server using VC++? Pin
JohnnyG17-Sep-02 3:41
JohnnyG17-Sep-02 3:41 
General[GDI+] OS compatibility query Pin
Nish Nishant16-Sep-02 22:43
sitebuilderNish Nishant16-Sep-02 22:43 
GeneralRe: [GDI+] OS compatibility query Pin
Stephane Rodriguez.17-Sep-02 2:08
Stephane Rodriguez.17-Sep-02 2:08 
GeneralRe: [GDI+] OS compatibility query Pin
Nish Nishant17-Sep-02 13:55
sitebuilderNish Nishant17-Sep-02 13:55 
GeneralADO calling stored proceures Pin
Anonymous16-Sep-02 22:37
Anonymous16-Sep-02 22:37 
GeneralRe: ADO calling stored proceures Pin
Jon Hulatt16-Sep-02 22:56
Jon Hulatt16-Sep-02 22:56 
GeneralThree Tier Layer Design and Db Grids... Pin
Braulio Dez16-Sep-02 22:30
Braulio Dez16-Sep-02 22:30 
GeneralPointer to a modal dialog Pin
AlecJames16-Sep-02 22:32
AlecJames16-Sep-02 22:32 
QuestionShow image in CRichEditCtrl ? Pin
Dmitry Timin16-Sep-02 22:22
sussDmitry Timin16-Sep-02 22:22 
QuestionWhy the compiler told me the class is redefined? Pin
wood16-Sep-02 21:45
wood16-Sep-02 21:45 
AnswerRe: Why the compiler told me the class is redefined? Pin
jmkhael16-Sep-02 21:49
jmkhael16-Sep-02 21:49 
AnswerRe: Why the compiler told me the class is redefined? Pin
Joaquín M López Muñoz16-Sep-02 21:50
Joaquín M López Muñoz16-Sep-02 21:50 
GeneralQuestion about Winsock Pin
nachilau16-Sep-02 21:40
nachilau16-Sep-02 21:40 
GeneralRe: Question about Winsock Pin
jmkhael16-Sep-02 21:46
jmkhael16-Sep-02 21:46 
GeneralRe: Question about Winsock Pin
nachilau17-Sep-02 19:11
nachilau17-Sep-02 19:11 

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.