strange linking behaviour

Discussion in 'C++' started by Wouter, Feb 24, 2004.

  1. Wouter

    Wouter Guest

    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
     
    Wouter, Feb 24, 2004
    #1
    1. Advertising

  2. Wouter

    Mike Wahler Guest

    Re: [OT, welcome msg, redir] strange linking behaviour

    "Wouter" <> wrote in message
    news:c1gj4r$ssv$...
    > 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
     
    Mike Wahler, Feb 24, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ryan Mack
    Replies:
    0
    Views:
    377
    Ryan Mack
    May 24, 2004
  2. sleepydj
    Replies:
    5
    Views:
    325
    Peter_Julian
    Oct 12, 2005
  3. Filimon Roukoutakis

    Strange linking behaviour

    Filimon Roukoutakis, Feb 3, 2007, in forum: C++
    Replies:
    2
    Views:
    282
    Filimon Roukoutakis
    Feb 3, 2007
  4. Andy Chambers
    Replies:
    1
    Views:
    411
    Daniel Dyer
    May 14, 2007
  5. Replies:
    5
    Views:
    363
    James Kuyper
    Oct 25, 2008
Loading...

Share This Page