Fix C10_API/C10_EXPORT for op schema registration (#15324)
authorSebastian Messmer <messmer@fb.com>
Wed, 9 Jan 2019 04:22:41 +0000 (20:22 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 9 Jan 2019 04:31:45 +0000 (20:31 -0800)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15324

This was missing but needs to be here, otherwise we can't register schemas without linker errors.

Reviewed By: ezyang

Differential Revision: D13500679

fbshipit-source-id: ba06351cb8ae09ec456cb93e527d388ace578fbb

c10/core/dispatch/DispatchTable.h
c10/core/dispatch/OpSchemaRegistration.h

index 13e904e..936d780 100644 (file)
@@ -151,4 +151,4 @@ class DispatchTable final {
  * we can't rely on the one-definition-rule.
  */
 template <class OpSchemaDef>
-c10::DispatchTable<OpSchemaDef>& c10_dispatch_table();
+C10_API c10::DispatchTable<OpSchemaDef>& c10_dispatch_table();
index 28f3b69..dc81c05 100644 (file)
@@ -11,7 +11,7 @@
  */
 #define C10_DEFINE_OP_SCHEMA(OpSchemaDef)                                         \
   template<>                                                                      \
-  c10::DispatchTable<OpSchemaDef>& c10_dispatch_table<OpSchemaDef>() {            \
+  C10_EXPORT c10::DispatchTable<OpSchemaDef>& c10_dispatch_table<OpSchemaDef>() { \
     static c10::DispatchTable<OpSchemaDef> singleton;                             \
     return singleton;                                                             \
   }