How do I use classes from a DLL?

J

Jake D

I have found many examples on how to use a function from a DLL, but I
have a DLL (not written by me) that has various classes, and functions
within.
How can I create an object of a class type defined in the DLL and
access functions from the class?
 
A

Alf P. Steinbach

I have found many examples on how to use a function from a DLL, but I
have a DLL (not written by me) that has various classes, and functions
within.
How can I create an object of a class type defined in the DLL and
access functions from the class?

The C++ standard has nothing to say on the subject of DLLs (except a very
indirect adaption in the wording for when statics are initialized).

It doesn't even have anything to say on the subject of name mangling.

Not even on the existence of linkers.

In short, if you're using a different compiler than the one used to
create the DLL, there is little chance that you can use that DLL, unless
the DLL is designed to be language-independent, e.g. COM conventions.

On the other hand, _if_ you have a compatible compiler, see that compiler's
documentation. <ot>Presumably, judging from the terminology, this is on
the Windows platform, and so check out 'dllimport' & friends; MS keywords
that most/many/some compilers for that platform understand.</ot>
 
S

shakahshakah

The developer of the DLL should supply you with header files to compile
against and an import library to link with.
 
K

Kevin Goodsell

The developer of the DLL should supply you with header files to compile
against and an import library to link with.

Please don't top post. See section 5 of the FAQ for posting guidelines.

http://www.parashift.com/c++-faq-lite/

Also, DLLs are not topical here. Please avoid posting off-topic
messages, even as a reply to a question. An alternative would be to send
the reply to a group where it is topical, and email the author of the
question with the location of your answer. Or you could email the author
directly with your answer.

-Kevin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,141
Messages
2,570,818
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top