[llvm-bugs] [Bug 44016] New: __declspec(dllexport) ignored on specialized function definitions

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Nov 15 14:01:05 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=44016

            Bug ID: 44016
           Summary: __declspec(dllexport) ignored on specialized function
                    definitions
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: me at mark-ingram.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

Created attachment 22817
  --> https://bugs.llvm.org/attachment.cgi?id=22817&action=edit
Example

Please see the attached files. Templated class functions that are specialized,
aren't added to the list of exported functions. In the attached example, any
binary linking to this shared library will fail to find dll<int>::Func().

// dll.hpp
#ifdef DLL_EXPORT
#define DLL_API __declspec(dllexport)
#else
#define DLL_API __declspec(dllimport)
#endif

template <typename T>
struct dll
{
    DLL_API static void Func();
};

// dll.cpp
#define DLL_EXPORT
#include "dll.hpp"

#include <stdio.h>

template <>
void dll<int>::Func()
{
    printf("dll<int>::Func1\n");
}

template class DLL_API dll<int>;

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191115/c246d74d/attachment-0001.html>


More information about the llvm-bugs mailing list