Click here to Skip to main content
15,913,467 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: chat window BG Pin
Antti Keskinen20-Jul-04 23:07
Antti Keskinen20-Jul-04 23:07 
GeneralDlls, callbacks and function pointers Pin
Irenepower20-Jul-04 10:51
Irenepower20-Jul-04 10:51 
GeneralRe: Dlls, callbacks and function pointers Pin
Antti Keskinen20-Jul-04 11:43
Antti Keskinen20-Jul-04 11:43 
GeneralRe: Dlls, callbacks and function pointers Pin
Member 124998021-Jul-04 3:37
Member 124998021-Jul-04 3:37 
GeneralRe: Dlls, callbacks and function pointers Pin
Antti Keskinen21-Jul-04 3:54
Antti Keskinen21-Jul-04 3:54 
GeneralRe: Dlls, callbacks and function pointers Pin
Member 124998021-Jul-04 4:59
Member 124998021-Jul-04 4:59 
GeneralRe: Dlls, callbacks and function pointers Pin
Antti Keskinen21-Jul-04 7:21
Antti Keskinen21-Jul-04 7:21 
GeneralRe: Dlls, callbacks and function pointers Pin
Antti Keskinen21-Jul-04 8:21
Antti Keskinen21-Jul-04 8:21 
This getting interestingly strange.

I did a few prelimenary checks of my own, and found out that if your main executable module and the DLL have similar objects declared, then using GetProcAddress will fail, if the methods of the classes are not declared as virtual.

I had a class called CMyDLLClass, and the same header file was contained in the DLL as well. Now, both the main module and the DLL created objects of this type. When the methods of the class were all declared as virtual, the run-time interpreted the pointers correctly. If they were not virtual, then calling the members through the pointer in the main module ALWAYS called the methods of the object declared in the main module's context, regardless of which pointer I used. More interestingly, the pointers pointed to different locations in memory as well...

This starts to feel like a bug in the compiler or the optimizations it uses. Not sure yet, though..

-Antti Keskinen

----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
GeneralRe: Dlls, callbacks and function pointers Pin
Member 124998021-Jul-04 10:11
Member 124998021-Jul-04 10:11 
GeneralRe: Dlls, callbacks and function pointers Pin
-Irenepower22-Jul-04 2:41
suss-Irenepower22-Jul-04 2:41 
GeneralCopyFile Error on XP Pin
Timothy Grabrian20-Jul-04 10:15
professionalTimothy Grabrian20-Jul-04 10:15 
GeneralRe: CopyFile Error on XP Pin
gamitech20-Jul-04 11:13
gamitech20-Jul-04 11:13 
GeneralRe: CopyFile Error on XP Pin
P-Rex20-Jul-04 20:15
P-Rex20-Jul-04 20:15 
GeneralRe: CopyFile Error on XP Pin
Timothy Grabrian21-Jul-04 11:15
professionalTimothy Grabrian21-Jul-04 11:15 
GeneralI need Help on Database Programming!!! Pin
Member 123981320-Jul-04 10:03
Member 123981320-Jul-04 10:03 
GeneralRe: I need Help on Database Programming!!! Pin
David Crow20-Jul-04 10:33
David Crow20-Jul-04 10:33 
GeneralCreating ActiveX control (variable types) Pin
BlackDice20-Jul-04 9:26
BlackDice20-Jul-04 9:26 
Generalwindow message Pin
Anonymous20-Jul-04 9:10
Anonymous20-Jul-04 9:10 
GeneralRe: window message Pin
Alexander Wiseman20-Jul-04 9:21
Alexander Wiseman20-Jul-04 9:21 
GeneralRe: window message Pin
Anonymous20-Jul-04 9:35
Anonymous20-Jul-04 9:35 
GeneralRe: window message Pin
Alexander Wiseman20-Jul-04 11:29
Alexander Wiseman20-Jul-04 11:29 
GeneralRe: window message Pin
Bob Stanneveld20-Jul-04 12:58
Bob Stanneveld20-Jul-04 12:58 
GeneralCOM programming Pin
Tropicana20-Jul-04 8:48
Tropicana20-Jul-04 8:48 
GeneralRe: COM programming Pin
Antti Keskinen20-Jul-04 11:58
Antti Keskinen20-Jul-04 11:58 
GeneralDoc/View Philosophical Question... Pin
Nitron20-Jul-04 8:11
Nitron20-Jul-04 8: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.