Click here to Skip to main content
16,014,650 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralSwitching mainframe menu (solution) Pin
Ravi Bhavnani12-Sep-04 8:23
professionalRavi Bhavnani12-Sep-04 8:23 
GeneralRe: Switching mainframe menu (solution) Pin
KaЯl13-Sep-04 3:55
KaЯl13-Sep-04 3:55 
QuestionHOw to convert from EMF to SWF. Pin
Azghar Hussain12-Sep-04 7:49
professionalAzghar Hussain12-Sep-04 7:49 
AnswerRe: HOw to convert from EMF to SWF. Pin
Christian Graus12-Sep-04 11:52
protectorChristian Graus12-Sep-04 11:52 
QuestionLink/C-calling convention ? Pin
0v3rloader12-Sep-04 6:46
0v3rloader12-Sep-04 6:46 
AnswerRe: Link/C-calling convention ? Pin
Antti Keskinen12-Sep-04 9:38
Antti Keskinen12-Sep-04 9:38 
GeneralRe: Link/C-calling convention ? Pin
0v3rloader12-Sep-04 22:59
0v3rloader12-Sep-04 22:59 
GeneralRe: Link/C-calling convention ? Pin
Antti Keskinen13-Sep-04 4:15
Antti Keskinen13-Sep-04 4:15 
If you want to be sure by what name a function is exported, use a module definition file and rebuild the DLL. For example:
// In DLL code, somewhere
__declspec(dllexport) int Setup(void);<DIV>

// The module definition file
LIBRARY   "MyDLL.DLL"<DIV>

EXPORTS
     Setup   @1
This would export the Setup function from the DLL with it's true name, and GetProcAddress will not fail if you ask it to look for a function called "Setup". Also, using both the __declspec and the definition file is just about making sure it works. It will not get exported twice.

Also, you can rename the exported symbols in the module definition file. Assuming that Setup is still the function name inside the DLL you wish to export, the following statement under EXPORTS would rename this symbol:
Exported1 = Setup   @1
Now, requesting "Exported1" with GetProcAddress would return the address of "Setup". However, asking for "Setup" would return an error.

Basically, the difference on which one to use depends on if you want a library file (.LIB) or not. The __declspec(dllexport) adds an entry to the library file, so that if you link with this library file, you can call the exported functions, and the DLL will be loaded and the function executed (static linking). However, if you use dynamic (run-time) loading, the module definition file is the only way to specify the names of the exported functions explicitly. It is not possible to use a library file with dynamic loading. This will not work, it is just not designed to work that way.

-Antti Keskinen

----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
GeneralRe: Link/C-calling convention ? Pin
0v3rloader14-Sep-04 1:47
0v3rloader14-Sep-04 1:47 
GeneralEnvironment macro Pin
Rome Singh12-Sep-04 6:31
Rome Singh12-Sep-04 6:31 
GeneralRe: Environment macro Pin
Andrew Walker12-Sep-04 14:46
Andrew Walker12-Sep-04 14:46 
GeneralRe: Environment macro Pin
Rome Singh13-Sep-04 5:12
Rome Singh13-Sep-04 5:12 
GeneralRe: Environment macro Pin
Andrew Walker13-Sep-04 12:52
Andrew Walker13-Sep-04 12:52 
QuestionWarning: no message line prompt for ID *???? Pin
jettocrack12-Sep-04 6:13
jettocrack12-Sep-04 6:13 
AnswerRe: Warning: no message line prompt for ID *???? Pin
Ravi Bhavnani12-Sep-04 7:13
professionalRavi Bhavnani12-Sep-04 7:13 
GeneralProblem Regarding Tree in DOTNET Pin
eshban28412-Sep-04 6:08
eshban28412-Sep-04 6:08 
GeneralRe: Problem Regarding Tree in DOTNET Pin
Antti Keskinen12-Sep-04 10:12
Antti Keskinen12-Sep-04 10:12 
GeneralDouble buffering in MFC Pin
amigaguy12-Sep-04 6:07
amigaguy12-Sep-04 6:07 
GeneralRe: Double buffering in MFC Pin
Antti Keskinen12-Sep-04 10:33
Antti Keskinen12-Sep-04 10:33 
GeneralRe: Double buffering in MFC Pin
Anonymous12-Sep-04 11:50
Anonymous12-Sep-04 11:50 
GeneralCDaoDatabase connection string in Windows XP Pin
olis12-Sep-04 5:36
olis12-Sep-04 5:36 
GeneralProcess help Pin
swarup12-Sep-04 4:40
swarup12-Sep-04 4:40 
GeneralToolbar in views Pin
Jens Christiansen12-Sep-04 3:26
Jens Christiansen12-Sep-04 3:26 
QuestionHow can I export my class in &quot;Regular DLL that statically linked MFC&quot;? Pin
Behzad Ebrahimi12-Sep-04 3:20
Behzad Ebrahimi12-Sep-04 3:20 
GeneralDialog in taskbar steals focus from children Pin
PEK12-Sep-04 1:49
PEK12-Sep-04 1:49 

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.