Solved

DLL in C++ classes

Posted on 1997-03-01
2
229 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

617 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