Solved

DLL in C++ classes

Posted on 1997-03-01
2
226 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

830 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