User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 363,803 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,558 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser:

importance of dllexport location in program

Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 9,916
Reputation: Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of 
Rep Power: 32
Solved Threads: 793
Moderator
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Posting Prodigy

Re: importance of dllexport location in program

  #6  
May 10th, 2008
>>From what I understand from MSDN, dllexport is supposed to substitute the export section in the .DEF file -

Your understanding is incorrect. What MSDN means is that you can export the function in one of two ways:
  • use the __dllspec( __dllexport ) tags
  • add an entry into the .DEF file

The compiler does not make any entries into the .DEF file for you -- you have to do that yourself if you want them there.

Prototyping the function as you did in a.cpp is not sufficient. You have to add dllexport in the function itself
a.cpp

__dllspec( __dllexport ) void a()
{
   // blabla
}

You can also export an entire c++ class
__dllspec( __dllexport) class MyClass
{
   // blabla
}
Last edited by Ancient Dragon : May 10th, 2008 at 9:15 am.
'Politics' is made up of two words, 'poli,' which is Greek for 'many,' and 'tics,' which are blood-sucking insects.
- Gore Vidal
Being ignorant is not so much a shame as being unwilling to learn. - Benjamin Franklin
Reply With Quote  
All times are GMT -4. The time now is 11:18 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC