Groups | Blog | Home
all groups > visual c libraries > december 2003 >

visual c libraries : DLL newbie


Abelardo Vacca
12/18/2003 8:46:29 AM
Hello,
Let me just begin by saying i'm pretty much lost here, so
bare with me plz.
Basically, I'm trying to obtain the same result one gets
when using a DLL in VB6. That's I want to create a DLL
with some classes on it, and be able to use them in a
project.
I have run into documentation explaining differents types
of DLL, each one with weird declarations on how to export
functions. If All I want is to encapsulate some classes
into a DLL, is there a simple way to do this?

I've tried what look as the obvious first thing to do:
created a dinamically linked MFC DLL, create a generic
class inside. genereated the dll and .lib, took the .h
from the class, and added the .lib to the linker path. On
my project I get unresolved external for the
constructor/desctructor (the only two functions on the
class)

As you can see, I don't even know where to begin, I guess
VB6 spoiled me.

tham
12/21/2003 9:21:08 PM
hey,

u are doin the right thing... u get the "unresolved external symbols" becoz u didnt declare your class as __declspec(dllexport)...

do something like this...

class __declspec(dllexport) MyClass

this will cause the compiler to export this class to the .lib

one note thought.. u are not suppose to pass MFC objects from dll to app using MFC Regular DLL.. u can do it if you chose MFC Extension dll.... see Tech Note TN033

AddThis Social Bookmark Button