summaryrefslogtreecommitdiffstats
path: root/tests/cpp-compiler/c-compile-shared-library.c
blob: 8b6be6115d55454ec73877385fd9a63cc6e1121b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//TEST(smoke):CPP_COMPILER_SHARED_LIBRARY: 

#include <stdlib.h>
#include <stdio.h>
#include <string.h>   
   
#if defined(_MSC_VER)
#   define DLL_EXPORT __declspec(dllexport)
#else 
//#   define DLL_EXPORT 
#   define DLL_EXPORT __attribute__ ((dllexport)) __attribute__((__visibility__("default")))
#endif    

#ifdef __cplusplus    
#define EXTERN_C extern "C"
#else
#define EXTERN_C 
#endif    
    
EXTERN_C DLL_EXPORT int test(int intValue, const char* textValue, char* outTextValue)
{
    strcpy(outTextValue, textValue);
    return intValue;
}