templates and libs/dlls
-
hi all, i am trying to export a class template from a static library using __declspec(dllexport). The library will compile fine, however importing it into my second project and attempting to instantiate it produces a number of unresolved external symbol linker errors, for each method. Is it possible to export templates from a static library?
-
hi all, i am trying to export a class template from a static library using __declspec(dllexport). The library will compile fine, however importing it into my second project and attempting to instantiate it produces a number of unresolved external symbol linker errors, for each method. Is it possible to export templates from a static library?
you need to provide the entire definition of the template, in order to 'export' it. a template is not a class - it's just a recipe that the compiler uses to make a real class. any compiler using your lib will need the whole template definition to build that class. this[^] might help. Cleek | Image Toolkits | Thumbnail maker -- modified at 16:50 Friday 9th September, 2005
-
you need to provide the entire definition of the template, in order to 'export' it. a template is not a class - it's just a recipe that the compiler uses to make a real class. any compiler using your lib will need the whole template definition to build that class. this[^] might help. Cleek | Image Toolkits | Thumbnail maker -- modified at 16:50 Friday 9th September, 2005
thanks for the link. so, there is no way to export the actual template, so that clients can recreate the templates with any types they need? What i am basically looking for is a way to reuse class templates in multiple projects. any suggestions?
-
thanks for the link. so, there is no way to export the actual template, so that clients can recreate the templates with any types they need? What i am basically looking for is a way to reuse class templates in multiple projects. any suggestions?
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
-
thanks for the link. so, there is no way to export the actual template, so that clients can recreate the templates with any types they need? What i am basically looking for is a way to reuse class templates in multiple projects. any suggestions?
zildjohn01 wrote: so, there is no way to export the actual template, so that clients can recreate the templates with any types they need? put the template in a .H file and let anyone who wants to use your template #include that .H file. Cleek | Image Toolkits | Thumbnail maker
-
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
thanks, that link explains why it doesn't work. so, tbe answer is no? oh well, i'll figure something out ;P