Skip to content

Commit b5c5bb6

Browse files
Gnimucvgvassilev
authored andcommitted
Fix symbol visibility issues for C API
1 parent 7caf10b commit b5c5bb6

File tree

1 file changed

+46
-39
lines changed

1 file changed

+46
-39
lines changed

Diff for: include/clang-c/CXCppInterOp.h

+46-39
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ typedef struct CXInterpreterImpl* CXInterpreter;
3434
*
3535
* \returns a \c CXInterpreter.
3636
*/
37-
CXInterpreter clang_createInterpreter(const char* const* argv, int argc);
37+
CINDEX_LINKAGE CXInterpreter clang_createInterpreter(const char* const* argv,
38+
int argc);
3839

3940
typedef void* TInterp_t;
4041

@@ -43,27 +44,29 @@ typedef void* TInterp_t;
4344
*
4445
* \returns a \c CXInterpreter.
4546
*/
46-
CXInterpreter clang_createInterpreterFromRawPtr(TInterp_t I);
47+
CINDEX_LINKAGE CXInterpreter clang_createInterpreterFromRawPtr(TInterp_t I);
4748

4849
/**
4950
* Returns a pointer to the underlying interpreter.
5051
*/
51-
void* clang_Interpreter_getClangInterpreter(CXInterpreter I);
52+
CINDEX_LINKAGE void* clang_Interpreter_getClangInterpreter(CXInterpreter I);
5253

5354
/**
5455
* Returns a \c TInterp_t and takes the ownership.
5556
*/
56-
TInterp_t clang_Interpreter_takeInterpreterAsPtr(CXInterpreter I);
57+
CINDEX_LINKAGE TInterp_t
58+
clang_Interpreter_takeInterpreterAsPtr(CXInterpreter I);
5759

5860
/**
5961
* Undo N previous incremental inputs.
6062
*/
61-
enum CXErrorCode clang_Interpreter_undo(CXInterpreter I, unsigned int N);
63+
CINDEX_LINKAGE enum CXErrorCode clang_Interpreter_undo(CXInterpreter I,
64+
unsigned int N);
6265

6366
/**
6467
* Dispose of the given interpreter context.
6568
*/
66-
void clang_Interpreter_dispose(CXInterpreter I);
69+
CINDEX_LINKAGE void clang_Interpreter_dispose(CXInterpreter I);
6770

6871
/**
6972
* Describes the return result of the different routines that do the incremental
@@ -95,8 +98,9 @@ typedef enum {
9598
*
9699
* \param prepend Whether to prepend the directory to the search path.
97100
*/
98-
void clang_Interpreter_addSearchPath(CXInterpreter I, const char* dir,
99-
bool isUser, bool prepend);
101+
CINDEX_LINKAGE void clang_Interpreter_addSearchPath(CXInterpreter I,
102+
const char* dir,
103+
bool isUser, bool prepend);
100104

101105
/**
102106
* Add an include path.
@@ -105,7 +109,8 @@ void clang_Interpreter_addSearchPath(CXInterpreter I, const char* dir,
105109
*
106110
* \param dir The directory to add.
107111
*/
108-
void clang_Interpreter_addIncludePath(CXInterpreter I, const char* dir);
112+
CINDEX_LINKAGE void clang_Interpreter_addIncludePath(CXInterpreter I,
113+
const char* dir);
109114

110115
/**
111116
* Declares a code snippet in \c code and does not execute it.
@@ -118,8 +123,8 @@ void clang_Interpreter_addIncludePath(CXInterpreter I, const char* dir);
118123
*
119124
* \returns a \c CXErrorCode.
120125
*/
121-
enum CXErrorCode clang_Interpreter_declare(CXInterpreter I, const char* code,
122-
bool silent);
126+
CINDEX_LINKAGE enum CXErrorCode
127+
clang_Interpreter_declare(CXInterpreter I, const char* code, bool silent);
123128

124129
/**
125130
* Declares and executes a code snippet in \c code.
@@ -130,7 +135,8 @@ enum CXErrorCode clang_Interpreter_declare(CXInterpreter I, const char* code,
130135
*
131136
* \returns a \c CXErrorCode.
132137
*/
133-
enum CXErrorCode clang_Interpreter_process(CXInterpreter I, const char* code);
138+
CINDEX_LINKAGE enum CXErrorCode clang_Interpreter_process(CXInterpreter I,
139+
const char* code);
134140

135141
/**
136142
* An opaque pointer representing a lightweight struct that is used for carrying
@@ -143,14 +149,14 @@ typedef void* CXValue;
143149
*
144150
* \returns a \c CXValue.
145151
*/
146-
CXValue clang_createValue(void);
152+
CINDEX_LINKAGE CXValue clang_createValue(void);
147153

148154
/**
149155
* Dispose of the given CXValue.
150156
*
151157
* \param V The CXValue to dispose.
152158
*/
153-
void clang_Value_dispose(CXValue V);
159+
CINDEX_LINKAGE void clang_Value_dispose(CXValue V);
154160

155161
/**
156162
* Declares, executes and stores the execution result to \c V.
@@ -163,8 +169,8 @@ void clang_Value_dispose(CXValue V);
163169
*
164170
* \returns a \c CXErrorCode.
165171
*/
166-
enum CXErrorCode clang_Interpreter_evaluate(CXInterpreter I, const char* code,
167-
CXValue V);
172+
CINDEX_LINKAGE enum CXErrorCode
173+
clang_Interpreter_evaluate(CXInterpreter I, const char* code, CXValue V);
168174

169175
/**
170176
* Looks up the library if access is enabled.
@@ -175,7 +181,8 @@ enum CXErrorCode clang_Interpreter_evaluate(CXInterpreter I, const char* code,
175181
*
176182
* \returns the path to the library.
177183
*/
178-
CXString clang_Interpreter_lookupLibrary(CXInterpreter I, const char* lib_name);
184+
CINDEX_LINKAGE CXString clang_Interpreter_lookupLibrary(CXInterpreter I,
185+
const char* lib_name);
179186

180187
/**
181188
* Finds \c lib_stem considering the list of search paths and loads it by
@@ -189,9 +196,8 @@ CXString clang_Interpreter_lookupLibrary(CXInterpreter I, const char* lib_name);
189196
*
190197
* \returns a \c CXInterpreter_CompilationResult.
191198
*/
192-
CXInterpreter_CompilationResult
193-
clang_Interpreter_loadLibrary(CXInterpreter I, const char* lib_stem,
194-
bool lookup);
199+
CINDEX_LINKAGE CXInterpreter_CompilationResult clang_Interpreter_loadLibrary(
200+
CXInterpreter I, const char* lib_stem, bool lookup);
195201

196202
/**
197203
* Finds \c lib_stem considering the list of search paths and unloads it by
@@ -201,7 +207,8 @@ clang_Interpreter_loadLibrary(CXInterpreter I, const char* lib_stem,
201207
*
202208
* \param lib_stem The stem of the library to unload.
203209
*/
204-
void clang_Interpreter_unloadLibrary(CXInterpreter I, const char* lib_stem);
210+
CINDEX_LINKAGE void clang_Interpreter_unloadLibrary(CXInterpreter I,
211+
const char* lib_stem);
205212

206213
/**
207214
* @}
@@ -226,40 +233,41 @@ typedef struct {
226233
} CXScope;
227234

228235
// for debugging purposes
229-
void clang_scope_dump(CXScope S);
236+
CINDEX_LINKAGE void clang_scope_dump(CXScope S);
230237

231238
/**
232239
* Checks if a class has a default constructor.
233240
*/
234-
bool clang_hasDefaultConstructor(CXScope S);
241+
CINDEX_LINKAGE bool clang_hasDefaultConstructor(CXScope S);
235242

236243
/**
237244
* Returns the default constructor of a class, if any.
238245
*/
239-
CXScope clang_getDefaultConstructor(CXScope S);
246+
CINDEX_LINKAGE CXScope clang_getDefaultConstructor(CXScope S);
240247

241248
/**
242249
* Returns the class destructor, if any.
243250
*/
244-
CXScope clang_getDestructor(CXScope S);
251+
CINDEX_LINKAGE CXScope clang_getDestructor(CXScope S);
245252

246253
/**
247254
* Returns a stringified version of a given function signature in the form:
248255
* void N::f(int i, double d, long l = 0, char ch = 'a').
249256
*/
250-
CXString clang_getFunctionSignature(CXScope func);
257+
CINDEX_LINKAGE CXString clang_getFunctionSignature(CXScope func);
251258

252259
/**
253260
* Checks if a function is a templated function.
254261
*/
255-
bool clang_isTemplatedFunction(CXScope func);
262+
CINDEX_LINKAGE bool clang_isTemplatedFunction(CXScope func);
256263

257264
/**
258265
* This function performs a lookup to check if there is a templated function of
259266
* that type. \c parent is mandatory, the global scope should be used as the
260267
* default value.
261268
*/
262-
bool clang_existsFunctionTemplate(const char* name, CXScope parent);
269+
CINDEX_LINKAGE bool clang_existsFunctionTemplate(const char* name,
270+
CXScope parent);
263271

264272
typedef struct {
265273
void* Type;
@@ -282,9 +290,8 @@ typedef struct {
282290
* \returns a \c CXScope representing the instantiated templated
283291
* class/function/variable.
284292
*/
285-
CXScope clang_instantiateTemplate(CXScope tmpl,
286-
CXTemplateArgInfo* template_args,
287-
size_t template_args_size);
293+
CINDEX_LINKAGE CXScope clang_instantiateTemplate(
294+
CXScope tmpl, CXTemplateArgInfo* template_args, size_t template_args_size);
288295

289296
/**
290297
* A fake CXType for working with the interpreter.
@@ -299,12 +306,12 @@ typedef struct {
299306
/**
300307
* Gets the string of the type that is passed as a parameter.
301308
*/
302-
CXString clang_getTypeAsString(CXQualType type);
309+
CINDEX_LINKAGE CXString clang_getTypeAsString(CXQualType type);
303310

304311
/**
305312
* Returns the complex of the provided type.
306313
*/
307-
CXQualType clang_getComplexType(CXQualType eltype);
314+
CINDEX_LINKAGE CXQualType clang_getComplexType(CXQualType eltype);
308315

309316
/**
310317
* An opaque pointer representing the object of a given type (\c CXScope).
@@ -314,18 +321,18 @@ typedef void* CXObject;
314321
/**
315322
* Allocates memory for the given type.
316323
*/
317-
CXObject clang_allocate(unsigned int n);
324+
CINDEX_LINKAGE CXObject clang_allocate(unsigned int n);
318325

319326
/**
320327
* Deallocates memory for a given class.
321328
*/
322-
void clang_deallocate(CXObject address);
329+
CINDEX_LINKAGE void clang_deallocate(CXObject address);
323330

324331
/**
325332
* Creates an object of class \c scope and calls its default constructor. If \c
326333
* arena is set it uses placement new.
327334
*/
328-
CXObject clang_construct(CXScope scope, void* arena);
335+
CINDEX_LINKAGE CXObject clang_construct(CXScope scope, void* arena);
329336

330337
/**
331338
* Creates a trampoline function and makes a call to a generic function or
@@ -341,8 +348,8 @@ CXObject clang_construct(CXScope scope, void* arena);
341348
*
342349
* \param self The 'this pointer' of the object.
343350
*/
344-
void clang_invoke(CXScope func, void* result, void** args, size_t n,
345-
void* self);
351+
CINDEX_LINKAGE void clang_invoke(CXScope func, void* result, void** args,
352+
size_t n, void* self);
346353

347354
/**
348355
* Calls the destructor of object of type \c type. When withFree is true it
@@ -354,7 +361,7 @@ void clang_invoke(CXScope func, void* result, void** args, size_t n,
354361
*
355362
* \param withFree Whether to call operator delete/free or not.
356363
*/
357-
void clang_destruct(CXObject This, CXScope S, bool withFree);
364+
CINDEX_LINKAGE void clang_destruct(CXObject This, CXScope S, bool withFree);
358365

359366
/**
360367
* @}

0 commit comments

Comments
 (0)