You are here: Part 9: RTI Monitoring Library > Using Monitoring Library in Your Application > Enabling Monitoring in Your Application > Method 2—Change the Participant QoS to Specify the Monitoring Library Create Function Pointer and Explicitly Load the Monitoring Library

Method 2—Change the Participant QoS to Specify the Monitoring Library Create Function Pointer and Explicitly Load the Monitoring Library

If any of the following are true, you must change the Participant QoS to enable monitoring and explicitly load the correct version of Monitoring Library at compile time:

There are two ways to do this:

Method 2-A: Change the Participant QoS by Specifying the Monitoring Library Create Function Pointer in Source Code

  1. Modify your Connext DDS application based on the following examples.
  2. Note:

    • In the above code, you may notice that valueBuffer is initialized to 17 characters. This is because a pointer (RTIDefaultMonitor_create) is at most 8 bytes (on a 64-bit system) and it takes two characters to represent a byte in hex. So the total size must be:
      (2 * 8 characters) + 1 null-termination character = 17 characters.
  1. Link the Monitoring Library for your platform into your application at compile time (the Monitoring libraries are listed in the RTI Connext DDS Core Libraries Platform Notes).
  2. The kind of monitoring library that you link into your application at compile time must be consistent with the kind of Connext DDS libraries that you are linking into your application (static/dynamic, release/debug version of the libraries).

    On Windows systems:ClosedIf you are linking a static monitoring library, you will also need to link in Psapi.lib at compile time.

Method 2-B: Change the Participant QoS by Specifying the Monitoring Library Create Function Pointer in an Environment Variable

This is similar to Method 2-A, but if you specify the function pointer value for rti.monitor.create_function_ptr in an environment variable that is set programmatically, you can specify your QoS either in an XML file or in source code. If you specify the QoS in an XML file, you can enable/disable monitoring without recompiling. If you change the QoS in your source code, you may need to recompile every time you enable/disable monitoring.

  1. In XML, enable monitoring by setting the rti.monitor.create_function_ptr property to an environment variable. In our example, the variable is named RTIMONITORFUNCPTR.
  2. <participant_qos> 
        <property> 
    	<value> 
    	    <element> 
    		<name>rti.monitor.library</name> 
    		<value>rtimonitoring</value> 
    	    </element> 
    	    <element> 
    		<name>rti.monitor.create_function_ptr</name> 
    		<value>$(RTIMONITORFUNCPTR)</value> 
    	    </element> 
    	</value> 
        </property>
    </participant_qos>
  3. In the DDS application that links in the monitoring library, get the function pointer of RTIDefaultMonitor_create and write it to the same environment variable you named in Step 1 and create a DomainParticipant by using the XML profile specified in Step 1. (Setting of the environment variable must appear in the application before it creates the DomainParticipant using the profile from Step 1.)
  4. Note: In the above code, you may notice that putenvBuffer is initialized to 34 characters. This is because a pointer (RTIDefaultMonitor_create) is at most 8 bytes (on a 64-bit system) and it takes 2 characters to represent a byte in hex. So the total size must be: strlen(RTIMONITORFUNCPTR) + (2 * 8 characters) + 1 null-termination character = 17 + 16 + 1 = 34 characters

  5. Link the Monitoring Library for your platform into your application at compile time (the Monitoring libraries are listed in the RTI Connext DDS Core Libraries Platform Notes).
  6. The kind of monitoring library that you link into your application at compile time must be consistent with the kind of Connext DDS libraries that you are linking into your application (static/dynamic, release/debug version of the libraries).

    On Windows systems: If you are linking a static monitoring library, you will also need to link in Psapi.lib at compile time.

© 2016 RTI