packaging template classses into libraries (static, dynamic)

P

puzzlecracker

Is it possible to package a template implementation class into a
library and how it is done (say into a dll or a static one).

Since template expansion in c++ is static and takes place at compile
time (unlike csharp), I would like to find out how we can simulate
that?


Thank
 
K

killerfox

Is it possible to package a template implementation class into a
library and how it is done (say into a dll or a static one).

Since template expansion in c++ is static and takes place at compile
time (unlike csharp), I would like to find out how  we can simulate
that?

Thank

I don't think that is possible at all, since libraries are already
compiled, and just need to be linked, whereas templates need to be
seen by the compiler to generate the code.

One thing I can think of is wrapping all your template headers into a
precompiled header, and include this in your other projects, but other
than that I don't think its possible.

-Kf-
 
J

John

http://www.informit.com/guides/content.aspx?g=cplusplus&seqNum=53
about exported template classes.

Is it possible to package a template implementation class into a
library and how it is done (say into a dll or a static one).

Since template expansion in c++ is static and takes place at compile
time (unlike csharp), I would like to find out how we can simulate
that?

Thank

I don't think that is possible at all, since libraries are already
compiled, and just need to be linked, whereas templates need to be
seen by the compiler to generate the code.

One thing I can think of is wrapping all your template headers into a
precompiled header, and include this in your other projects, but other
than that I don't think its possible.

-Kf-
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top