strange linking behaviour

W

Wouter

Hi all,

I'm creating a DLL which contains a certain class ( class A), but i forgot
to export it. I created instances from this class in the DLL and passed a
pointers to the executable. I then called some VIRTUAL operations on the
instances. No problem so far. Everything compiled and linked flawless. I
used static linking so the class was also declared in the executable's
project.
I then created some extra non-virtual functionality for class A and wanted
to call these functions too. Now my linker started to complain about
unresolved externals. A quick glance at the header made clear that I forgot
to export the class. I corrected this and again no further problems.
(Visual Studio 6.0)

This made me starting to wonder why the executable did get linked in the
first case where I only called the virtual functions. I would have thought
the linker should also have been complaining. Or am I wrong ?

Can anybody explain this ?

thanks,

Wouter
 
M

Mike Wahler

Wouter said:
Hi all,

I'm creating a DLL which contains a certain class ( class A), but i forgot
to export it. I created instances from this class in the DLL and passed a
pointers to the executable. I then called some VIRTUAL operations on the
instances. No problem so far. Everything compiled and linked flawless. I
used static linking so the class was also declared in the executable's
project.
I then created some extra non-virtual functionality for class A and wanted
to call these functions too. Now my linker started to complain about
unresolved externals. A quick glance at the header made clear that I forgot
to export the class. I corrected this and again no further problems.
(Visual Studio 6.0)

This made me starting to wonder why the executable did get linked in the
first case where I only called the virtual functions. I would have thought
the linker should also have been complaining. Or am I wrong ?

Can anybody explain this ?

Linkers and their behavior are not topical here. Each one will work
in its own way, also necessarily dependent upon the environment in which
it is used.

This newsgroup is about the platform-independent C++ programming language.
See: http://www.slack.net/~shiva/welcome.txt

For help with your linker, consult support resources available from its
vendor, e.g. websites, tech support, etc. There are probably also one
or more newsgroups which discuss it. Check www.groups.google.com
or www.usenet.org etc, to find them.

-Mike
 

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

Similar Threads

Linking with library 2
Linking problem 6
Linking error 5
Linking error 1
Linking errors with IAR 0
Abstract class linking issue 4
Linking error .. 3
Problem in Linking 1

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top