File: test-dll.cpp

package info (click to toggle)
libmongocrypt 1.17.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,572 kB
  • sloc: ansic: 70,067; python: 4,547; cpp: 615; sh: 460; makefile: 44; awk: 8
file content (27 lines) | stat: -rw-r--r-- 553 bytes parent folder | download
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
26
27
/**
 * This file is not a test case. This file is to generate a dynamic library for
 * testing the dll loading code.
 */

#include <iostream>
#include <string>

static std::string global_str;

#if defined(_MSC_VER)
#define SAY_HELLO_EXPORT __declspec(dllexport)
#else
#define SAY_HELLO_EXPORT __attribute__((visibility("default")))
#endif

extern "C" {

SAY_HELLO_EXPORT int say_hello(); // -Wmissing-prototypes: for testing only.

int say_hello() {
    global_str = "Hello, DLL!";
    std::cout << global_str << "\n";
    return 42;
}

} // extern "C"