Flip Configuration Guide

Using Flip as a Dynamic Linked Library (DLL)

This chapter explains how to set up your build environment to use the Flip framework in a Dynamic Linked Library (dll).

Overview

Integrating the Flip framework as a Dynamic Linked Library consists on exporting, importing or changing the visibility of symbols. Those changes are platform specific.

Even when not using the gyp build system, the gyp and gypi makes a good reference for the necessary tasks to execute to integrate the Flip framework.

The following sections will describe tasks to achieve.

Using the gyp build system

This section describes how to use the Flip framework as a Dynamic Linked Library when using the gyp build system.

It consists of two parts :

The following two subsections will describe those two tasks.

In the DLL target

From the DLL target point of view, one will need to :

The following block of code shows how this is done in a gypi file.

{
   'target_name': 'my_dll_target',
   'type': 'shared_library',
   'xcode_settings': {
      'OTHER_CFLAGS': [
         '-fvisibility=default',
      ],
   },
   'defines': [
      'flip_TYPE_REGISTRY_MODE=flip_TYPE_REGISTRY_ENABLED',
   ],
   'conditions': [
      ['OS=="win"', {
         'defines': [
            'flip_API=__declspec(dllexport)',
            'flip_API_EXPORT=__declspec(dllexport)',
         ],
      }],
   ],
   'includes' : [
      'relative/path/to/flip_src.gypi',
   ],
}

In the target using the DLL target

From the target using the DLL target point of view, one will need to :

The following block of code shows how this is done in a gypi file.

{
   'target_name': 'my_main_target',
   'xcode_settings': {
      'OTHER_CFLAGS': [
         '-fvisibility=default',
      ],
   },
   'dependencies': [
      'my_dll_target',
   ],
   'defines': [
      'flip_TYPE_REGISTRY_MODE=flip_TYPE_REGISTRY_ENABLED',
   ],
   'conditions': [
      ['OS=="win"', {
         'defines': [
            'flip_API=__declspec(dllimport)',
            'flip_API_EXPORT=__declspec(dllexport)',
         ],
      }],
   ],
   'include_dirs': [
      'relative/path/to/include',
   ],
   ...your sources and everything else...
}

Doing it Manually

This section describes how to integrate the Flip framework as a Dynamic Linked Library manually in your build system.

It consists of two parts :

The following two subsections will describe those two tasks for each platform.

XCode DLL Target

On XCode, one will need to set up a dynamic linked library like a bundle.

All Flip framework core and optionnaly contribution files must be added to the target.

The XCode setting "Other C Flags" (OTHER_CFLAGS) should add the line -fvisibility=default

The XCode setting "Preprocessor Macros" (GCC_PREPROCESSOR_DEFINITIONS) should add the line flip_TYPE_REGISTRY_MODE=flip_TYPE_REGISTRY_ENABLED

Visual Studio DLL Target

On Visual Studio, one will need to set up a dynamic linked library.

All Flip framework core and optionnaly contribution files must be added to the target.

The Visual Studio Configuration Properties for C/C++ for Preprocessor should add to the Preprocessor Definitions the following element :

XCode using the DLL Target

The XCode setting "Other C Flags" (OTHER_CFLAGS) should add the line -fvisibility=default

The XCode setting "Preprocessor Macros" (GCC_PREPROCESSOR_DEFINITIONS) should add the line flip_TYPE_REGISTRY_MODE=flip_TYPE_REGISTRY_ENABLED

Visual Studio using the DLL Target

The Visual Studio Configuration Properties for C/C++ for Preprocessor should add to the Preprocessor Definitions the following element :

Note: the declspec for flip_API_EXPORT must be dllexport and not dllimport.