This patch add LLDB_API to the class declaration for the API classes. It was already present in the forward declaration in SBDefines.h. I need LLDB_API to be part of the declaration to build a DLL that exports the API and can be successfully linked with driver. This only effects Windows. Ok to apply?
api.patch (13.8 KB)
Right now LLDB_API is used only for windows and turns into __declspec(dllexport) or __declspec(dllimport). The main question is if we are going to try and use these for other compiles (like using the GCC attribute for visibility). If we ever decide to use the GCC attributes in LLDB_API, then we might need one for functions: LLDB_API_FUNCTION and one for classes LLDB_API_CLASS.
So for now this is fine as the __declspec() works on classes for windows, but if we put __attribute__((....)) in there I don't believe this works on class definitions to export the entire class...
So yes, OK to apply.
The LLDB_API define in the SBDefines.h already exports the API to build liblldb.dll successfully on Windows.
Why do they have to be added again to each class declaration?
I encountered a build error which forced me to add these to class declaration. But I will hold the patch for now and do some more experiments. May be error source was somewhere else. In any case, I think we should add them so that class declarations are consistent with forward declarations.