In most cases, compiled C shading functions will be linked to the program as shared libraries. The library can also link existing object files and C source files. This is handled by the LINK module and is outside the scope of the API module. However, API allows verbatim specification of C sources as part of the scene definition with the following three calls. Use of these functions is discouraged except when parsing .mi2 scene files because the overhead is significantly higher than linking shared libraries.
miBoolean mi_api_code_verbatim_begin(void)
Begin the definition of verbatim code. This call opens a temporary file in /usr/tmp with a unique file name that receives the C sources.
miBoolean mi_api_code_byte_copy( int length, /* # of data bytes */ miUchar *bytes) /* C src data array */
Append ascii source text to the C source file opened by the preceding call. The bytes string is expected to contain length characters, not counting a trailing null byte (which is not required). The bytes pointer, like any other string passed to an API call, is released using mi_mem_release.
miBoolean mi_api_code_verbatim_end(void)
After the sources have been stored with one or more byte copy calls, this call completes the verbatim source definition. The temporary file is closed, compiled, linked, loaded, and removed.
Copyright © 1986, 2015 NVIDIA ARC GmbH. All rights reserved.