Flutter Engine
The Flutter Engine
Classes | Macros | Functions
ffi_test_dynamic_library.cc File Reference
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>

Go to the source code of this file.

Classes

struct  some_resource
 

Macros

#define DART_EXPORT    extern "C" __attribute__((visibility("default"))) __attribute((used))
 

Functions

DART_EXPORT intptr_t return42 ()
 
DART_EXPORT double timesFour (double d)
 
DART_EXPORT void MemMove (void *destination, void *source, intptr_t num_bytes)
 
DART_EXPORT some_resourceAllocateResource ()
 
DART_EXPORT void UseResource (some_resource *resource)
 
DART_EXPORT void ReleaseResource (some_resource *resource)
 

Macro Definition Documentation

◆ DART_EXPORT

#define DART_EXPORT    extern "C" __attribute__((visibility("default"))) __attribute((used))

Definition at line 13 of file ffi_test_dynamic_library.cc.

Function Documentation

◆ AllocateResource()

DART_EXPORT some_resource * AllocateResource ( )

Definition at line 36 of file ffi_test_dynamic_library.cc.

36 {
37 void* pointer = malloc(sizeof(int64_t));
38
39 // Dummy initialize.
40 static_cast<int64_t*>(pointer)[0] = 10;
41
42 return static_cast<some_resource*>(pointer);
43}
void * malloc(size_t size)
Definition: allocation.cc:19

◆ MemMove()

DART_EXPORT void MemMove ( void *  destination,
void *  source,
intptr_t  num_bytes 
)

Definition at line 28 of file ffi_test_dynamic_library.cc.

28 {
29 memmove(destination, source, num_bytes);
30}
SkBitmap source
Definition: examples.cpp:28

◆ ReleaseResource()

DART_EXPORT void ReleaseResource ( some_resource resource)

Definition at line 50 of file ffi_test_dynamic_library.cc.

50 {
51 free(resource);
52}
static SkString resource(SkPDFResourceType type, int index)

◆ return42()

DART_EXPORT intptr_t return42 ( )

Definition at line 17 of file ffi_test_dynamic_library.cc.

17 {
18 return 42;
19}

◆ timesFour()

DART_EXPORT double timesFour ( double  d)

Definition at line 21 of file ffi_test_dynamic_library.cc.

21 {
22 return d * 4.0;
23}
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
Definition: main.cc:19

◆ UseResource()

DART_EXPORT void UseResource ( some_resource resource)

Definition at line 45 of file ffi_test_dynamic_library.cc.

45 {
46 // Dummy change.
47 reinterpret_cast<int64_t*>(resource)[0] += 10;
48}