Solved

DLL in C++ classes

Posted on 1997-03-01
2
221 Views
Last Modified: 2010-04-10
How to declare member function in def file of class ?

Declaretion as dll_name.class_name.function_name doesn't
correct.
0
Comment
Question by:a121496
2 Comments
 
LVL 3

Expert Comment

by:os012897
ID: 1162125
Can you be a bit more specific on what compiler you are using??

Regards,

         os

0
 

Accepted Solution

by:
pangofil earned 50 total points
ID: 1162126
It depends on the compiler You are using :
each one has his own naming convention.

But You can declare whole class as __export
and leave DEF file default.

#ifdef __DLL__
#define MYCLASSDEC __export
#else
#define MYCLASSDEC __import
#endif

class MYCALSSDEC MyClass
 {
   .....

 } ;

After linking DLL, make LIB file for it ( by IMPLIB utility ) and link LIB file to EXE You are callin DLL from.

It works for BC++ & VC++

Another way to do it :

Make outclass function, what calls class memeber function :

extern "C"
{
 int FAR PASCAL __export MyCallFunc ( ... )
  {
    return my_class.MemeberFunc ( ... ) ;
  }
}

MyCallFunc can be defined as EXPORT in DEF file.

Hope, it helps.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now