problem using self built DLL

I made an MFC extension DLL, but I couldn't get it working on the
client application. Can somebody please tell me what I did wrong in
the procedure:

1. I started an MFC extension DLL project called "MyDll". I added a
class called "MyClass" and added the keyword AFX_EXT_CLASS in the
class declaration in the header file.

2. I built the project and copied the files "MyDll.dll" and
"MyDll.lib" to the client project folder.

3. In the client project settings, I added the file MyDll.lib in the
linker - input section.

4. I made a MyDll.h file with the line: class AFX_EXT_CLASS MyClass;

5. I used #include "MyDll.h" in the cpp files where I need MyClass.

With the above steps, I expect MyClass to be defined. But when I use
the imported class it gave me the error:

error C2079: 'CClientApp::myobject' uses undefined class 'MyClass'


Please advise.

0
ericwan78 (38)
4/20/2007 6:47:16 PM
vc.mfc 33608 articles. 0 followers. Follow

9 Replies
970 Views

Similar Articles

[PageSpeed] 24

"wanwan" <ericwan78@yahoo.com> wrote in message 
news:1177094836.742967.148600@l77g2000hsb.googlegroups.com...
> 4. I made a MyDll.h file with the line: class AFX_EXT_CLASS MyClass;
>
> 5. I used #include "MyDll.h" in the cpp files where I need MyClass.
>
> With the above steps, I expect MyClass to be defined. But when I use
> the imported class it gave me the error:
>
> error C2079: 'CClientApp::myobject' uses undefined class 'MyClass'
>

The compiler needs to see the entire class definition of MyClass for it to 
know what are the methods and member data the client can call.  Defining it

  class AFX_EXT_CLASS MyClass;

is not sufficient for compiling the client, e.g.:

    MyClass MyClassInstance;
    MyClassInstance.SomeMemberFunction();

because the compiler can't see SomeMemberFunction() is a member of MyClass.

-- David 

0
dc2983 (3206)
4/20/2007 6:59:54 PM
On 20 Apr 2007 11:47:16 -0700, wanwan <ericwan78@yahoo.com> wrote:

>I made an MFC extension DLL, but I couldn't get it working on the
>client application. Can somebody please tell me what I did wrong in
>the procedure:
>
>1. I started an MFC extension DLL project called "MyDll". I added a
>class called "MyClass" and added the keyword AFX_EXT_CLASS in the
>class declaration in the header file.

You should use your own macro instead of AFX_EXT_CLASS, because otherwise
your DLL won't be able to #include headers from another DLL that also uses
AFX_EXT_CLASS, i.e. one extension DLL won't be able to use another
extension DLL. Below is a message I've posted several times concerning the
right way to use __declspec: 

In some DLL header file, which the other DLL headers #include, write the 
following, replacing "X" with the name of your DLL, making sure it has a 
reasonable chance of being unique: 

#ifdef COMPILING_X_DLL 
#define X_EXPORT __declspec(dllexport) 
#else 
#define X_EXPORT __declspec(dllimport) 
#endif 

Then #define COMPILING_X_DLL only in that DLL's project. This method can be
used by multiple DLLs, a big advantage over AFX_EXT_CLASS, and since the 
macro names are unique, they don't conflict. Then you can do things like: 

X_EXPORT void f(); 

class X_EXPORT MyClass 
{ 
   ... 
}; 

Look in the project's preprocessor options, and you may find the AppWizard 
has already defined a suitable COMPILING_X_DLL macro for you. 

>2. I built the project and copied the files "MyDll.dll" and
>"MyDll.lib" to the client project folder.
>
>3. In the client project settings, I added the file MyDll.lib in the
>linker - input section.
>
>4. I made a MyDll.h file with the line: class AFX_EXT_CLASS MyClass;

This defines an incomplete type called MyClass. About all you can do with
it is use it to declare pointer and reference types.

>5. I used #include "MyDll.h" in the cpp files where I need MyClass.
>
>With the above steps, I expect MyClass to be defined. But when I use
>the imported class it gave me the error:
>
>error C2079: 'CClientApp::myobject' uses undefined class 'MyClass'

You need to #include the header that defines MyClass; IOW, you need to
#include the header that contains:

class AFX_EXT_CLASS MyClass
{
.... class definition
};

This means your DLL's header files (at least the ones that export things)
have to be available to the DLL clients. This gets to be a royal pain.
Typically I handle it all by defining my own "lib" and "include"
directories. In the project settings, I relocate the DLL output files to my
lib and rename them so they don't conflict, sort of like what MS does with
MFC42.DLL vs MFC42D.DLL and all the variants. Then I create subdirectories
in my "include" folder for each library and move their public headers
there. I add my "include" folder to the compiler's list and #include the
files with:

#include <libname/filename.h>

As for the .lib files, I add my "lib" directory to the linker's list and
use #pragma comment(lib) in the public DLL header files to select the right
libraries; this relieves me from having to add the libraries to each
project's linker settings. You can also add "lib" to the IDE's PATH list so
the DLL's will be available when you try to run your programs.

To tie all this together, I create a file "DeclSpec.h" for each DLL, and it
typically looks like this:

#pragma once

#ifdef COMPILING_X_DLL
#define X_EXPORT __declspec(dllexport)
#else
#define X_EXPORT __declspec(dllimport)
#endif

#ifndef COMPILING_X_DLL
#  ifdef _DEBUG
#     pragma comment(lib, "XD.lib")
#  else
#     pragma comment(lib, "X.lib")
#  endif
#endif

Then every public DLL header file #includes "DeclSpec.h" first thing. It
gets more complicated when you have static library variants, Unicode
versions, etc, but that's the basic pattern.

-- 
Doug Harrison
Visual C++ MVP
0
dsh (2498)
4/20/2007 9:23:01 PM
On Apr 20, 5:23 pm, "Doug Harrison [MVP]" <d...@mvps.org> wrote:
> On 20 Apr 2007 11:47:16 -0700, wanwan <ericwa...@yahoo.com> wrote:
>
> >I made an MFC extension DLL, but I couldn't get it working on the
> >client application. Can somebody please tell me what I did wrong in
> >the procedure:
>
> >1. I started an MFC extension DLL project called "MyDll". I added a
> >class called "MyClass" and added the keyword AFX_EXT_CLASS in the
> >class declaration in the header file.
>
> You should use your own macro instead of AFX_EXT_CLASS, because otherwise
> your DLL won't be able to #include headers from another DLL that also uses
> AFX_EXT_CLASS, i.e. one extension DLL won't be able to use another
> extension DLL. Below is a message I've posted several times concerning the
> right way to use __declspec:
>
> In some DLL header file, which the other DLL headers #include, write the
> following, replacing "X" with the name of your DLL, making sure it has a
> reasonable chance of being unique:
>
> #ifdef COMPILING_X_DLL
> #define X_EXPORT __declspec(dllexport)
> #else
> #define X_EXPORT __declspec(dllimport)
> #endif
>
> Then #define COMPILING_X_DLL only in that DLL's project. This method can be
> used by multiple DLLs, a big advantage over AFX_EXT_CLASS, and since the
> macro names are unique, they don't conflict. Then you can do things like:
>
> X_EXPORT void f();
>
> class X_EXPORT MyClass
> {
>    ...
>
> };
>
> Look in the project's preprocessor options, and you may find the AppWizard
> has already defined a suitable COMPILING_X_DLL macro for you.
>
> >2. I built the project and copied the files "MyDll.dll" and
> >"MyDll.lib" to the client project folder.
>
> >3. In the client project settings, I added the file MyDll.lib in the
> >linker - input section.
>
> >4. I made a MyDll.h file with the line: class AFX_EXT_CLASS MyClass;
>
> This defines an incomplete type called MyClass. About all you can do with
> it is use it to declare pointer and reference types.
>
> >5. I used #include "MyDll.h" in the cpp files where I need MyClass.
>
> >With the above steps, I expect MyClass to be defined. But when I use
> >the imported class it gave me the error:
>
> >error C2079: 'CClientApp::myobject' uses undefined class 'MyClass'
>
> You need to #include the header that defines MyClass; IOW, you need to
> #include the header that contains:
>
> class AFX_EXT_CLASS MyClass
> {
> ... class definition
>
> };
>
> This means your DLL's header files (at least the ones that export things)
> have to be available to the DLL clients. This gets to be a royal pain.
> Typically I handle it all by defining my own "lib" and "include"
> directories. In the project settings, I relocate the DLL output files to my
> lib and rename them so they don't conflict, sort of like what MS does with
> MFC42.DLL vs MFC42D.DLL and all the variants. Then I create subdirectories
> in my "include" folder for each library and move their public headers
> there. I add my "include" folder to the compiler's list and #include the
> files with:
>
> #include <libname/filename.h>
>
> As for the .lib files, I add my "lib" directory to the linker's list and
> use #pragma comment(lib) in the public DLL header files to select the right
> libraries; this relieves me from having to add the libraries to each
> project's linker settings. You can also add "lib" to the IDE's PATH list so
> the DLL's will be available when you try to run your programs.
>
> To tie all this together, I create a file "DeclSpec.h" for each DLL, and it
> typically looks like this:
>
> #pragma once
>
> #ifdef COMPILING_X_DLL
> #define X_EXPORT __declspec(dllexport)
> #else
> #define X_EXPORT __declspec(dllimport)
> #endif
>
> #ifndef COMPILING_X_DLL
> #  ifdef _DEBUG
> #     pragma comment(lib, "XD.lib")
> #  else
> #     pragma comment(lib, "X.lib")
> #  endif
> #endif
>
> Then every public DLL header file #includes "DeclSpec.h" first thing. It
> gets more complicated when you have static library variants, Unicode
> versions, etc, but that's the basic pattern.
>
> --
> Doug Harrison
> Visual C++ MVP

so is it required to export the default constructer/destructer for the
client application to instantiate class objects?

0
ericwan78 (38)
4/20/2007 10:22:31 PM
On 20 Apr 2007 15:22:31 -0700, wanwan <ericwan78@yahoo.com> wrote:

>so is it required to export the default constructer/destructer for the
>client application to instantiate class objects?

All functions your DLL client calls must be exported. For member functions,
this happens automatically when you export the whole class. The compiler
will generate the default ctor, dtor, copy ctor, and assignment operator
per the language rules as needed, so if you want to keep them in your DLL,
you need to define and implement the ones you want clients to be able to
use. To prevent their use, you can declare them private but not define
them, which is the standard way to prevent the default functions from being
generated and to turn their use into compile or link-time errors.

-- 
Doug Harrison
Visual C++ MVP
0
dsh (2498)
4/20/2007 11:44:37 PM
See below...
On 20 Apr 2007 11:47:16 -0700, wanwan <ericwan78@yahoo.com> wrote:

>I made an MFC extension DLL, but I couldn't get it working on the
>client application. Can somebody please tell me what I did wrong in
>the procedure:
>
>1. I started an MFC extension DLL project called "MyDll". I added a
>class called "MyClass" and added the keyword AFX_EXT_CLASS in the
>class declaration in the header file.
>
>2. I built the project and copied the files "MyDll.dll" and
>"MyDll.lib" to the client project folder.
>
>3. In the client project settings, I added the file MyDll.lib in the
>linker - input section.
>
>4. I made a MyDll.h file with the line: class AFX_EXT_CLASS MyClass;
*****
So right there, you have made a serious error.  You have declared that there is a class
called MyClass, AND YOU HAVE SAID NOTHING MORE ABOUT IT!  This is a "forward"
declaration, wherein you promise to say something later.
*****
>
>5. I used #include "MyDll.h" in the cpp files where I need MyClass.
>
>With the above steps, I expect MyClass to be defined. But when I use
>the imported class it gave me the error:
>
>error C2079: 'CClientApp::myobject' uses undefined class 'MyClass'
*****
You get this error because it IS an undefined class.  You promised to say something about
it later, and never did, so there is no possible way for the compiler to know what the
class does.  It does not know what size it is, what members it has, or anything other than
its name (of course, had you wanted to give a meaningful error message, you would have
shown the line that this erorr complains about.  It would be obvious; it would be a
declaration of a MyClass variable, or an attempt to use any method or access any member of
the class).

Your .h file must contain the entire class declaration.  If you do not want the
implementation visible, then the .h file declares the class, and your implementation will
declare a derived subclass of that class.
					joe
*****
*****
>
>
>Please advise.
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15974)
4/22/2007 5:03:00 PM
On Apr 22, 1:03 pm, Joseph M. Newcomer <newco...@flounder.com> wrote:
> See below...
> On 20 Apr 2007 11:47:16 -0700, wanwan <ericwa...@yahoo.com> wrote:
>
> >I made an MFC extension DLL, but I couldn't get it working on the
> >client application. Can somebody please tell me what I did wrong in
> >the procedure:
>
> >1. I started an MFC extension DLL project called "MyDll". I added a
> >class called "MyClass" and added the keyword AFX_EXT_CLASS in the
> >class declaration in the header file.
>
> >2. I built the project and copied the files "MyDll.dll" and
> >"MyDll.lib" to the client project folder.
>
> >3. In the client project settings, I added the file MyDll.lib in the
> >linker - input section.
>
> >4. I made a MyDll.h file with the line: class AFX_EXT_CLASS MyClass;
>
> *****
> So right there, you have made a serious error.  You have declared that there is a class
> called MyClass, AND YOU HAVE SAID NOTHING MORE ABOUT IT!  This is a "forward"
> declaration, wherein you promise to say something later.
> *****
>
> >5. I used #include "MyDll.h" in the cpp files where I need MyClass.
>
> >With the above steps, I expect MyClass to be defined. But when I use
> >the imported class it gave me the error:
>
> >error C2079: 'CClientApp::myobject' uses undefined class 'MyClass'
>
> *****
> You get this error because it IS an undefined class.  You promised to say something about
> it later, and never did, so there is no possible way for the compiler to know what the
> class does.  It does not know what size it is, what members it has, or anything other than
> its name (of course, had you wanted to give a meaningful error message, you would have
> shown the line that this erorr complains about.  It would be obvious; it would be a
> declaration of a MyClass variable, or an attempt to use any method or access any member of
> the class).
>
> Your .h file must contain the entire class declaration.  If you do not want the
> implementation visible, then the .h file declares the class, and your implementation will
> declare a derived subclass of that class.
>                                         joe
> *****
> *****
>
> >Please advise.
>
> Joseph M. Newcomer [MVP]
> email: newco...@flounder.com
> Web:http://www.flounder.com
> MVP Tips:http://www.flounder.com/mvp_tips.htm

My impression is that the class MyClass is loaded from the DLL after I
specify the library file in linker.
In my test program, MyClass has no member function or member
variable.  I thought I would start to add them after I get the DLL
working.

If I'm supposed to give the details of MyClass in source code, what's
the point of building a DLL?

0
ericwan78 (38)
4/22/2007 10:22:53 PM
You are confusing code loading strategy with compilation strategy; they are only vaguely
related.  While it is true that the CODE that IMPLEMENTS the class is not loaded until
runtime, the compiler still has to know about the class and all its methods, members, its
size, etc., AT COMPILE TIME or it can't connect to that code.
					joe

On 22 Apr 2007 15:22:53 -0700, wanwan <ericwan78@yahoo.com> wrote:

>On Apr 22, 1:03 pm, Joseph M. Newcomer <newco...@flounder.com> wrote:
>> See below...
>> On 20 Apr 2007 11:47:16 -0700, wanwan <ericwa...@yahoo.com> wrote:
>>
>> >I made an MFC extension DLL, but I couldn't get it working on the
>> >client application. Can somebody please tell me what I did wrong in
>> >the procedure:
>>
>> >1. I started an MFC extension DLL project called "MyDll". I added a
>> >class called "MyClass" and added the keyword AFX_EXT_CLASS in the
>> >class declaration in the header file.
>>
>> >2. I built the project and copied the files "MyDll.dll" and
>> >"MyDll.lib" to the client project folder.
>>
>> >3. In the client project settings, I added the file MyDll.lib in the
>> >linker - input section.
>>
>> >4. I made a MyDll.h file with the line: class AFX_EXT_CLASS MyClass;
>>
>> *****
>> So right there, you have made a serious error.  You have declared that there is a class
>> called MyClass, AND YOU HAVE SAID NOTHING MORE ABOUT IT!  This is a "forward"
>> declaration, wherein you promise to say something later.
>> *****
>>
>> >5. I used #include "MyDll.h" in the cpp files where I need MyClass.
>>
>> >With the above steps, I expect MyClass to be defined. But when I use
>> >the imported class it gave me the error:
>>
>> >error C2079: 'CClientApp::myobject' uses undefined class 'MyClass'
>>
>> *****
>> You get this error because it IS an undefined class.  You promised to say something about
>> it later, and never did, so there is no possible way for the compiler to know what the
>> class does.  It does not know what size it is, what members it has, or anything other than
>> its name (of course, had you wanted to give a meaningful error message, you would have
>> shown the line that this erorr complains about.  It would be obvious; it would be a
>> declaration of a MyClass variable, or an attempt to use any method or access any member of
>> the class).
>>
>> Your .h file must contain the entire class declaration.  If you do not want the
>> implementation visible, then the .h file declares the class, and your implementation will
>> declare a derived subclass of that class.
>>                                         joe
>> *****
>> *****
>>
>> >Please advise.
>>
>> Joseph M. Newcomer [MVP]
>> email: newco...@flounder.com
>> Web:http://www.flounder.com
>> MVP Tips:http://www.flounder.com/mvp_tips.htm
>
>My impression is that the class MyClass is loaded from the DLL after I
>specify the library file in linker.
>In my test program, MyClass has no member function or member
>variable.  I thought I would start to add them after I get the DLL
>working.
>
>If I'm supposed to give the details of MyClass in source code, what's
>the point of building a DLL?
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15974)
4/23/2007 2:01:46 AM
On Apr 22, 10:01 pm, Joseph M. Newcomer <newco...@flounder.com> wrote:
> You are confusing code loading strategy with compilation strategy; they are only vaguely
> related.  While it is true that the CODE that IMPLEMENTS the class is not loaded until
> runtime, the compiler still has to know about the class and all its methods, members, its
> size, etc., AT COMPILE TIME or it can't connect to that code.
>                                         joe
>
> On 22 Apr 2007 15:22:53 -0700, wanwan <ericwa...@yahoo.com> wrote:
>
>
>
> >On Apr 22, 1:03 pm, Joseph M. Newcomer <newco...@flounder.com> wrote:
> >> See below...
> >> On 20 Apr 2007 11:47:16 -0700, wanwan <ericwa...@yahoo.com> wrote:
>
> >> >I made an MFC extension DLL, but I couldn't get it working on the
> >> >client application. Can somebody please tell me what I did wrong in
> >> >the procedure:
>
> >> >1. I started an MFC extension DLL project called "MyDll". I added a
> >> >class called "MyClass" and added the keyword AFX_EXT_CLASS in the
> >> >class declaration in the header file.
>
> >> >2. I built the project and copied the files "MyDll.dll" and
> >> >"MyDll.lib" to the client project folder.
>
> >> >3. In the client project settings, I added the file MyDll.lib in the
> >> >linker - input section.
>
> >> >4. I made a MyDll.h file with the line: class AFX_EXT_CLASS MyClass;
>
> >> *****
> >> So right there, you have made a serious error.  You have declared that there is a class
> >> called MyClass, AND YOU HAVE SAID NOTHING MORE ABOUT IT!  This is a "forward"
> >> declaration, wherein you promise to say something later.
> >> *****
>
> >> >5. I used #include "MyDll.h" in the cpp files where I need MyClass.
>
> >> >With the above steps, I expect MyClass to be defined. But when I use
> >> >the imported class it gave me the error:
>
> >> >error C2079: 'CClientApp::myobject' uses undefined class 'MyClass'
>
> >> *****
> >> You get this error because it IS an undefined class.  You promised to say something about
> >> it later, and never did, so there is no possible way for the compiler to know what the
> >> class does.  It does not know what size it is, what members it has, or anything other than
> >> its name (of course, had you wanted to give a meaningful error message, you would have
> >> shown the line that this erorr complains about.  It would be obvious; it would be a
> >> declaration of a MyClass variable, or an attempt to use any method or access any member of
> >> the class).
>
> >> Your .h file must contain the entire class declaration.  If you do not want the
> >> implementation visible, then the .h file declares the class, and your implementation will
> >> declare a derived subclass of that class.
> >>                                         joe
> >> *****
> >> *****
>
> >> >Please advise.
>
> >> Joseph M. Newcomer [MVP]
> >> email: newco...@flounder.com
> >> Web:http://www.flounder.com
> >> MVP Tips:http://www.flounder.com/mvp_tips.htm
>
> >My impression is that the class MyClass is loaded from the DLL after I
> >specify the library file in linker.
> >In my test program, MyClass has no member function or member
> >variable.  I thought I would start to add them after I get the DLL
> >working.
>
> >If I'm supposed to give the details of MyClass in source code, what's
> >the point of building a DLL?
>
> Joseph M. Newcomer [MVP]
> email: newco...@flounder.com
> Web:http://www.flounder.com
> MVP Tips:http://www.flounder.com/mvp_tips.htm

I understood that part. I'm not sure if you read me previous message.
The MyClass class that I put into the DLL has no member variable or
member function. I made it for the purpose of trying it on the client
application because I'm new to DLL programming. Since it's an "empty"
class , I'd think the only line needed in the header is:

class AFX_EXT_CLASS MyClass;
or
class __declspec(dllimport) MyClass;

After I code the client application with the DLL, I should be able to
instantiate a MyClass object. I may be still missing some steps which
cause the error (please read above for my procedure.

Is there a good DLL tutorial that I can read on the internet? I tried
my best to follow some tutorials, but still no success.

0
ericwan78 (38)
4/23/2007 6:26:06 AM
No, you are still missing the point.  The declaration

class AFX_EXT_CLASS whatever;

says to the compiler, "I will tell you about this class in detail before you need it". You
never do tell it.  This is NOT the same as

class AFX_EXT_CLASS whatever {
};

which says "This is a class with no member variables and no methods".  The two concepts
are separate, and you cannot substitute the first form for the second form.  The first
form is a promise that the second form will appear later.  It allows you to do things like
declare pointers to the class, but it does not allow you to do anything BUT declare
pointers (or references) to the class.  The first time you do anything that requires
knowledge of the class, the compiler complains that you failed to tell it about the class
you promised to tell it about.
					joe

On 22 Apr 2007 23:26:06 -0700, wanwan <ericwan78@yahoo.com> wrote:

>On Apr 22, 10:01 pm, Joseph M. Newcomer <newco...@flounder.com> wrote:
>> You are confusing code loading strategy with compilation strategy; they are only vaguely
>> related.  While it is true that the CODE that IMPLEMENTS the class is not loaded until
>> runtime, the compiler still has to know about the class and all its methods, members, its
>> size, etc., AT COMPILE TIME or it can't connect to that code.
>>                                         joe
>>
>> On 22 Apr 2007 15:22:53 -0700, wanwan <ericwa...@yahoo.com> wrote:
>>
>>
>>
>> >On Apr 22, 1:03 pm, Joseph M. Newcomer <newco...@flounder.com> wrote:
>> >> See below...
>> >> On 20 Apr 2007 11:47:16 -0700, wanwan <ericwa...@yahoo.com> wrote:
>>
>> >> >I made an MFC extension DLL, but I couldn't get it working on the
>> >> >client application. Can somebody please tell me what I did wrong in
>> >> >the procedure:
>>
>> >> >1. I started an MFC extension DLL project called "MyDll". I added a
>> >> >class called "MyClass" and added the keyword AFX_EXT_CLASS in the
>> >> >class declaration in the header file.
>>
>> >> >2. I built the project and copied the files "MyDll.dll" and
>> >> >"MyDll.lib" to the client project folder.
>>
>> >> >3. In the client project settings, I added the file MyDll.lib in the
>> >> >linker - input section.
>>
>> >> >4. I made a MyDll.h file with the line: class AFX_EXT_CLASS MyClass;
>>
>> >> *****
>> >> So right there, you have made a serious error.  You have declared that there is a class
>> >> called MyClass, AND YOU HAVE SAID NOTHING MORE ABOUT IT!  This is a "forward"
>> >> declaration, wherein you promise to say something later.
>> >> *****
>>
>> >> >5. I used #include "MyDll.h" in the cpp files where I need MyClass.
>>
>> >> >With the above steps, I expect MyClass to be defined. But when I use
>> >> >the imported class it gave me the error:
>>
>> >> >error C2079: 'CClientApp::myobject' uses undefined class 'MyClass'
>>
>> >> *****
>> >> You get this error because it IS an undefined class.  You promised to say something about
>> >> it later, and never did, so there is no possible way for the compiler to know what the
>> >> class does.  It does not know what size it is, what members it has, or anything other than
>> >> its name (of course, had you wanted to give a meaningful error message, you would have
>> >> shown the line that this erorr complains about.  It would be obvious; it would be a
>> >> declaration of a MyClass variable, or an attempt to use any method or access any member of
>> >> the class).
>>
>> >> Your .h file must contain the entire class declaration.  If you do not want the
>> >> implementation visible, then the .h file declares the class, and your implementation will
>> >> declare a derived subclass of that class.
>> >>                                         joe
>> >> *****
>> >> *****
>>
>> >> >Please advise.
>>
>> >> Joseph M. Newcomer [MVP]
>> >> email: newco...@flounder.com
>> >> Web:http://www.flounder.com
>> >> MVP Tips:http://www.flounder.com/mvp_tips.htm
>>
>> >My impression is that the class MyClass is loaded from the DLL after I
>> >specify the library file in linker.
>> >In my test program, MyClass has no member function or member
>> >variable.  I thought I would start to add them after I get the DLL
>> >working.
>>
>> >If I'm supposed to give the details of MyClass in source code, what's
>> >the point of building a DLL?
>>
>> Joseph M. Newcomer [MVP]
>> email: newco...@flounder.com
>> Web:http://www.flounder.com
>> MVP Tips:http://www.flounder.com/mvp_tips.htm
>
>I understood that part. I'm not sure if you read me previous message.
>The MyClass class that I put into the DLL has no member variable or
>member function. I made it for the purpose of trying it on the client
>application because I'm new to DLL programming. Since it's an "empty"
>class , I'd think the only line needed in the header is:
>
>class AFX_EXT_CLASS MyClass;
>or
>class __declspec(dllimport) MyClass;
>
>After I code the client application with the DLL, I should be able to
>instantiate a MyClass object. I may be still missing some steps which
>cause the error (please read above for my procedure.
>
>Is there a good DLL tutorial that I can read on the internet? I tried
>my best to follow some tutorials, but still no success.
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15974)
4/23/2007 6:36:12 AM
Reply:

Similar Artilces:

Using VBS t o configure outlook
is it possible to create a vbs script to automatically configure outlook 2002 for user on a domain. Thanks James ...

Date/Time criteria problem
I am trying to create a query that allows a user to select a specific date for which to show results. Following is sample SQL with a fixed criteria: SELECT qryShopJobsIO1.JOB_NO, qryShopJobsIO1.[TOTAL QUANTITY ORDERED], qryShopJobsIO1.[ENTRY DATE], qryShopJobsIO1.SumOfTotalHours FROM qryShopJobsIO1 WHERE (((qryShopJobsIO1.[ENTRY DATE])=#4/27/2010#)); This particular example returns no records. I know that I have records for which the ENTRY DATE field is 4/27/2010. I believe that the problem is that the default value of that field (in the table definition) is set to =Now() ...

Problem with date
Hi, I just converted my adp project from Access 2000 to Access 2003. In the 2000 version the date written on the SQL server are OK (mm/dd/yyyy). I use the Access 2000 in French and the SQL server is version 7 in English, and the date is ok on the SQL server. After the conversion the date on the SQL server is dd/mm/yyyy. I used Access 2003 in French and the same sql server that I used with the 2000 version. The regional paramater are the same, English (USA), but my workstation is a Windows French 2000 . The command that insert the data in the sql server is an INSERT INTO with a variable, ...

Problems with contact!
Hello, I have created a lot of contacts with external address in Active Directory and after I have created Address Lists in Exchange 2003 that contains these contacts. All works fine except 1 contact. When I try to send an email to this contact from Outlook 2003, inmediatly it comes with a non delivery report that says that "The email address doesn�t exist in this organization, please contact administrator......". All other contacts works fine and there are a lot of them that belongs to the same email domain. I have tryed to remove and create again, and refresh and reconstruct the ad...

Exchange 2003: Free/busy problem
Hi, All of a sudden as of a couple of days ago, when anyone in my exchange org tries to invite people to a meeting, a message displays when they try to check the other person's availability that says "No free/busy information could be retrieved" What I noticed that may have changed is that the public folder that apparently used to house this information is gone. So I followed instructions on microsoft's website to reset the system folders. Once that was done, I restarted the info store on all the servers in the admin group... but I still get the "no free/busy&...

Using Exmerge #2
Hi there, I'm using Exmerge for the first time on an Exchange 2003 box. I was reading through the KB article 174197 http://support.microsoft.com/kb/174197/ and it says "Before you run this program, make sure that the Microsoft Outlook Client and the Microsoft Exchange Administrator program are installed on the computer that Exmerge.exe is being run on." then in the next paragraph it notes, "We recommend that you do not install Outlook on the Exchange server." So, before I go installing anything can someone please point me in the correct direction? Can I run exmerg...

no warning file in use
Hi. I've got a question about a shared Excel file stored on Windows 2000 server. This file is accessed by two different Windows XP end users running Excel 2002 on their machines. Recently these two different end users have been accessing the same shared Excel file simultaneously without the usual file lock or warning that the file is in use. Sometimes they get the warning, sometimes not. When they don't, they assume they have rights to save to the file, only to find later on that their changes were not saved. I'm having both check for updates so that their Microsoft s...

Closed Investment Problem
One of my closed investments still appeats on my Money Home Page Investment Summary. All the other investments appearing in the summary are open, except this one. I checked the investment transactions for this investment and they are all correct, resulting in a zero share balance. Help!! How can I get rid of this appearing in the investment summary without deleting all the investment's data? Thanks! http://www.umpmfaq.info/faqdb.php?q=98 might give you a solution to this. -- Glyn Simpson, Microsoft MVP - Money http://money.mvps.org Check http://support.microsoft.com/default...

Problem with "Search box" in Help window
We are using Excel 2003 on XP. This problem is occuring for all users. When you click Help-Microsoft Excel Help, and try to type in the Search for: box under Assistance, the text is inserted into the spreadsheet instead. The only way you can manage to enter any text into this box is to copy it, then right-click paste it into that box (Edit-Paste and Ctrl+V do not work) I can't find anything in the kbase (except for the tip about pasting). What is up with this? ...

CDOSys.dll and Basic Authentication
I am trying to use Microsoft CDO For Windows 2000 Library (cdosys.dll, version 6.6.6001.18000) for sending email from an Access 2007 application. Here is my code, somewhat altered for readability etc: Dim oCDOMessage As New CDO.Message Dim oCDOConfig As New CDO.Configuration oCDOConfig.Fields.Item(cdoSendUsingMethod) = CdoSendUsing.cdoSendUsingPort oCDOConfig.Fields.Item(cdoSMTPServer) = "smtp.example.com" oCDOConfig.Fields.Item(cdoSMTPServerPort) = 25 oCDOConfig.Fields.Item(cdoSMTPAuthenticate) = cdoBasic ...

Problem with CTreeCtrl and WS_CLIPCHILDREN
Hi All, I have a modeless dialog that is a child of a view. The dialog has the WS_CLIPCHILDREN flag set so that it reduces the flickering effect of resize and redraws. The dialog has a CTreeCtrl with tooltips. Here is the problem: If I have a enough items in the tree control to where the vertical scroll bar is shown, and an item is long enough where the tooltip shows up. When I hover over a long item and the tooltip is up, if I scroll the tree control the new item which should be drawn where the tooltip was in not drawn at all (the background of the dialog box is drawn instead). This is e...

E-mail signature: problem with tables
I have created an e-mail signature using a table to control the layout and formatting. This is fine until I reply or forward a message, as the signature then joins to the message I am trying to forward/reply to. I have gone into Advanced Edit > Table > Table Properties and set the text wrapping to 'None', which seems to work. However, when I make any edits to the signature it resets the table wrapping back to 'around', so that I get the problem repeated. Any ideas? EssexSi <EssexSi@discussions.microsoft.com> wrote: > I have created an e-mail signature ...

SUMPRODUCT using Time between two values
Thanks in advance for any help you can provide me. I have a sheet with the following layout of data (shortened here and changed for obvious reasons) Venue Date Event Start Event End Act Disney 4/13/10 7:00 PM 10:00 PM Goofy MSG 2/13/10 1:00 PM 3:00 PM Basketball Park 3/14/10 6:00 PM 8:00 PM Harlem Globetrotters So, what I have is a user input a Venue, Date, Time Value, and I would need the Act returned... For example, Disney, 4/13/10, 8:25:13 PM, would ou...

Excel Queries using Access data
Im trying to create a query from within Excel. When I select new database query and select a database which has no securtiy login/password, no problem, works fine. However, when I try to source the data from a database which I have created using user logins/passwords it says that I do not have admin privilages to use the database even though I am putting in the correct login/username in the popup window? Please can anyone help? I've had limited experience with this sort of thing but I've always had to strip out the protection on the Access Database and create a copy before suc...

Public Folder Replication problems #4
I have 2 exchange 2003 servers in the same exchange org. I added the new exchange 2003 server to the public older replication but the folders did not replicatce. Both servers have the same patches. Below is: Event Type: Error Event Source: MSExchangeIS Public Store Event Category: Replication Errors Event ID: 3093 Date: 9/19/2005 Time: 9:09:45 AM User: N/A Computer: SYNMAIL1 Description: Error -2147221233 reading property 0x674b0014 on object type tbtMsgFolder from database "First Storage Group\Public Folder Store (SYNMAIL1)". For more information, click http://www.microso...

Virus Outbreak by using SMTP virtual server
Hi, The client was accidentally open approved-password.zip file then the nightmare began to spread out. It will use "system administrator" and "webmaster" as sender to inform the user that their password is grant or deny. Today, it tried to send out as NDR style. I assumed the virus on the workstation is using our smtp server. Will there a log that SMTP virtual server may generate so I can keep cross reference such as workstation or username so I can pinpoint? Any suggestion or recommendation will be appreciated. I am currently using Trend Micro Offican or Scan...

FAX notification problem
SBS 2003 R2 SP2 is installed and working pretty well. FAX's are received, sent to a selected folder just fine. Notifications doesn't work. I have tried sending to a local Exchange user or an internet address and it doesn't happen. What I'm trying to find is what is the transport that the system uses for this messaging. I don't see any related event messages. Any help would be appreciated. Doug Sanders Hi Doug, Thanks for your post. First of all, I still would like to suggest you double check the fax recipients notification configurat...

Publisher 2007 Birthday card jpg rotation problem
I'm running SP2 MSO and selected the Birthday 4 template. It's a side fold card template. I wanted to change the image on the front (page 1) and the inside left (page 2). I had two jpgs on my computer, so I used Insert-Picture-From File... . In each case when they were inserted, I need to rotate them CCW 90 degrees, so I grabbed the green dot rotate handle and rotated them so they were right side up (they were flowers). I then added a text box above each one. The print preview showed the correct orientation of the flowers with respect to the text above them for both page 1 and pag...

Workflow Posturl problem
HI I have created a webservice in .net that takes the lead id then queries our ordering system and writes some data back to CRM. When i add the post url in workflow manager and then create a lead, the action enters the workflow monitor in a paused state it also write the following to the even log MSCRM Platform Error Report -------------------------------------------------------------------------------------------------------- Error: <description>Error in action posturl.</description><details>Failed to connect the url http://localhost/test/OrderCheck.asmx/DoOrderCheck...

There is a problem with this website's security certificate
Hello, I bought an SSL certificate for my server (Windows Server 2003, IIS 6.0). Server included already a web site with SSL certificate, so I created a 2nd web site with different IP and different SSL certificate and different application pool that is running. When I try to access the 2nd web site I get a message from IE "There is a problem with this website's security certificate." If I click on option "Continue to this website (not recommended)", I get error "service unavailable" What could be the problem ? 1st web site is running without ...

Converting access tables to XML for use in .NET web app
I need to access tables in an .mdb file and convert them to XML for use in my ..NET 2.0 web application. Can anyone point me to any tutorials or references on how to accomplish this? (Note: I am using VB) Thanks! ...

Possible to open word documents in Excel using hyperlinks?
Hi, I wondered whether it was possible to open office documents from within MS Excel using hyperlinks to the related files. The documents in question are MS Word format. Cheers Have you try it ? Ctrl-K Existing file ...... -- Regards Ron de Bruin http://www.rondebruin.nl "DobieM" <DobieM@discussions.microsoft.com> wrote in message news:2DFD72F1-0F21-4414-929D-4D9307997D68@microsoft.com... > Hi, > I wondered whether it was possible to open office documents from within MS > Excel using hyperlinks to the related files. The documents in question are MS > Wor...

Can you share a calendar using Outlook web access?
We are using Outlook Web Access only. Is there a way to share calendars? In news:AED7800B-502A-44D1-A386-5A9274753BDB@microsoft.com, betzie <betzie@discussions.microsoft.com> typed: > We are using Outlook Web Access only. Is there a way to share > calendars? You can access a calendar (or any mailbox folder, I believe) if it's already shared - but you can't create the share/set the permissions in OWA. You might post OWA questions in microsoft.public.exchange.clients - OWA is part of Exchange, not Outlook. ...

Remove blank entries from a list box either using VBA or basic formula #3
Thanks Debra Havent thought about using dynamic ranges before.....I am a bit of Excel learner. I shall look into this as you suggest. Thanks again Celtic_avenge -- Celtic_Avenge ----------------------------------------------------------------------- Celtic_Avenger's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1410 View this thread: http://www.excelforum.com/showthread.php?threadid=27183 ...

Workbook Memory Problem
I have worked up an excel document that consists of four sheets, one sheet being the data entry sheet which then in turn post data to the other sheets providing needed information. It also includes links to external workbooks to calculate the end result. When the output is posted we then need to save the workbook for future reference for up to one year. Problem: The files are consistently around 1.5 megs after the data is posted which at the frequency that the forms are created is not ideal. So what would you suggest? *Some brainstorming I had: Do I save it as data file that will not...