This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Idea for export Implemnation


>>>>> Kevin Atkinson <kevinatk@home.com> writes:

 > Jason Merrill wrote:
 >> 
 >> >>>>> Kevin Atkinson <kevinatk@home.com> writes:
 >> 
 >>  > I am glade someone has actually thought about how to implement the
 >>  > export keyword.  Do you think you will have something ready by egcs 1.2?
 >> 
 >> No.

 > Ok do you have any idea when?

Not currently.  I'm very busy.

 >> 
 >>  >> And then there's the question of how to handle inlines; the initial
 >>  >> implementation probably won't inline anything in an exported template.
 >> 
 >>  > I always thought that inlines should ALWAYS go in the header files.  I
 >>  > thought the export keyword was only for non-inline templates.  Am i
 >>  > missing something here?
 >> 
 >> I mean, expanding arbitrary inline functions within instantiations of
 >> exported templates, not inline exported templates.

 > I am a little confused here.

OK, here's what I mean:

  foo.cc:
  export template <class T> T g (T);

  inline int f (int i) { return i+1; }

  int main()
  {
    g (3);
  }

  g.cc:
  export template <class T> T 
  g (T t)
  {
    f (t);
  }

When we link foo.o and g.o together, f will not be inlined into g (int).

 >>  > Ok but what about libraries?  Will there be no shared template
 >>  > instations for libraries?
 >> 
 >> Libraries will be handled exactly the same way.  I'm not sure what you're
 >> asking.

 > What I mean is if two different applications use a vector<int> will this
 > code be shared are will they each have there own copy.

Oh, you mean for a shared library?  In that case you would want to build
the library such that it would provide all the instantiations it uses, so
that applications that link against it get them for free.

Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]