-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Rationalize API exports in torch_python #68095
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#pragma once | ||
|
||
#include <c10/macros/Export.h> | ||
|
||
#ifdef THP_BUILD_MAIN_LIB | ||
#define TORCH_PYTHON_API C10_EXPORT | ||
#else | ||
#define TORCH_PYTHON_API C10_IMPORT | ||
#endif |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,2 @@ | ||
#pragma once | ||
|
||
#include <c10/macros/Export.h> | ||
|
||
#ifdef _WIN32 | ||
#define TORCH_PYTHON_API | ||
#else | ||
#define TORCH_PYTHON_API TORCH_API | ||
#endif | ||
#include <torch/csrc/Export.h> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to re-add the extern here? (and in other places)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extern
is necessary for variables defined in another file, but it doesn't apply to classes or structs which is why there were two macros:THP_API
andTHP_CLASS
. Now we just have one and manually addextern
. This is consistent with how all the other_API
macros work.