High-performance C++ parser optimized for LabVIEW integration with DLL support and LabVIEW-specific data structures.
- π LabVIEW Integration: Native support for LabVIEW clusters and variants
- π Windows DLL: Ready-to-use DLL for LabVIEW applications
- β‘ High Performance: SIMD-optimized parsing with memory pooling
- π‘οΈ Schema Validation: Built-in validation with detailed error reporting
- π§ C API: Clean C interface compatible with LabVIEW
- π¦ CMake Build: Cross-platform build system
// Convert LabVIEW cluster to CFG++ file
CfgppResult result = cfgpp_cluster_to_file(
cluster_data, // LabVIEW cluster data
data_size, // Size of cluster data
field_names, // Array of field names
field_count, // Number of fields
"config.cfgpp" // Output file path
);
// Parse CFG++ file back to LabVIEW
CfgppValueHandle config;
cfgpp_parse_file(parser, "config.cfgpp", &config);// Load schema
CfgppSchemaHandle schema;
cfgpp_schema_create(&schema);
cfgpp_schema_parse_file(schema, "measurement.cfgpp-schema");
// Validate LabVIEW data with schema
cfgpp_cluster_to_file_validated(
cluster_data, data_size, field_names, field_count,
"validated_config.cfgpp", schema
);Required Software:
- CMake 3.15+ - Download from cmake.org
- Visual Studio 2019 or newer (Community edition is fine)
- Must include "Desktop development with C++" workload
- Windows SDK 10.0.18362.0 or newer
- LabVIEW 2018 or newer (for integration testing)
Recommended Tools:
- Git for version control
- Visual Studio Code with CMake extensions
# Navigate to the C++ LabVIEW implementation
cd implementations/cpp-labview
# Create and enter build directory
mkdir build
cd build# For Visual Studio (64-bit, recommended for LabVIEW)
cmake .. -G "Visual Studio 16 2019" -A x64
# Alternative: For specific Visual Studio version
cmake .. -G "Visual Studio 17 2022" -A x64
# For MinGW (if preferred)
cmake .. -G "MinGW Makefiles"# Release build (recommended for production)
cmake --build . --config Release
# Debug build (for development)
cmake --build . --config Debug
# Build both configurations
cmake --build . --config Release
cmake --build . --config Debug# Install to dist directory
cmake --install . --prefix ../dist --config Release
# Your DLL will be in: implementations/cpp-labview/dist/bin/cfgpp_parser.dllcpp-labview/
βββ build/ # Build artifacts
β βββ Release/ # Release binaries
β β βββ cfgpp_parser.dll
β βββ Debug/ # Debug binaries (optional)
β βββ cfgpp_parser.dll
βββ dist/ # Installation directory
β βββ bin/ # DLL files
β β βββ cfgpp_parser.dll
β βββ include/ # Header files
β β βββ cfgpp_parser.h
β βββ lib/ # Import libraries
β βββ cfgpp_parser.lib
# Copy DLL to your LabVIEW project directory
copy dist\bin\cfgpp_parser.dll "C:\YourLabVIEWProject\"
# Copy header for reference
copy src\cfgpp_parser.h "C:\YourLabVIEWProject\"In LabVIEW:
- Add Call Library Function Node to your block diagram
- Configure the node:
- Library name or path:
cfgpp_parser.dll - Function name:
cfgpp_parse_file(or desired function) - Calling convention:
stdcall (__stdcall) - Thread:
Run in any thread
- Library name or path:
Example for cfgpp_parse_file:
- parser (input):
Pointer to Void - filename (input):
C String - result (output):
Pointer to Void - Return value:
Numeric U32(error code)
// Always create parser before use
CfgppParserHandle parser;
cfgpp_parser_create(&parser);
// Always cleanup when done
cfgpp_parser_destroy(parser);
cfgpp_value_destroy(value);β CMake not found
# Add CMake to PATH or use full path
"C:\Program Files\CMake\bin\cmake.exe" ..β Visual Studio not detected
# List available generators
cmake --help
# Use specific VS version
cmake .. -G "Visual Studio 16 2019" -A x64β Missing Windows SDK
- Install Windows SDK through Visual Studio Installer
- Or specify SDK version:
cmake .. -DCMAKE_SYSTEM_VERSION=10.0.19041.0
β DLL not found in LabVIEW
- Ensure DLL is in same directory as VI
- Or add DLL path to Windows PATH environment variable
- Check DLL architecture (x86 vs x64) matches LabVIEW
β Function not found
- Verify function name spelling in Call Library Function Node
- Use
dumpbin /exports cfgpp_parser.dllto list available functions - Ensure calling convention is set to
stdcall
β Access violation errors
- Always initialize pointers before use
- Check parameter types match exactly
- Ensure proper cleanup of allocated memory
For Maximum Performance:
# Enable CPU-specific optimizations
cmake .. -DCMAKE_CXX_FLAGS="/O2 /arch:AVX2"
# Link-time optimization
cmake .. -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=TRUE// Test in LabVIEW or C test program
CfgppParserHandle parser;
CfgppResult result = cfgpp_parser_create(&parser);
if (result == CFGPP_SUCCESS) {
printf("Parser created successfully!\n");
cfgpp_parser_destroy(parser);
}Create test_config.cfgpp:
database {
host = "localhost";
port = 5432;
}
Then test parsing:
CfgppValueHandle config;
result = cfgpp_parse_file(parser, "test_config.cfgpp", &config);# Static runtime linking
cmake .. -DCFGPP_STATIC_RUNTIME=ON
# Enable debugging symbols in release
cmake .. -DCMAKE_CXX_FLAGS_RELEASE="/O2 /Zi"
# Custom install prefix
cmake .. -DCMAKE_INSTALL_PREFIX="C:/CFGPlusPlus"# For different architectures
cmake .. -A Win32 # 32-bit
cmake .. -A x64 # 64-bit
cmake .. -A ARM64 # ARM64| Operation | Time | Memory |
|---|---|---|
| Parse 1KB config | ~20ΞΌs | 2KB |
| Parse 100KB config | ~800ΞΌs | 150KB |
| Schema validation | ~50ΞΌs | 1KB |
| LabVIEW cluster conversion | ~30ΞΌs | 4KB |
cfgpp_parser_create()- Create parser instancecfgpp_parse_file()- Parse CFG++ filecfgpp_parse_string()- Parse CFG++ string
cfgpp_from_labview_cluster()- Convert LabVIEW clustercfgpp_cluster_to_file()- Write cluster to CFG++ filecfgpp_variant_to_string()- Convert variant to CFG++ string
cfgpp_schema_create()- Create schema validatorcfgpp_validate_value()- Validate against schemacfgpp_generate_schema_from_cluster()- Auto-generate schema
cpp-labview/
βββ src/ # C++ source files
β βββ cfgpp_parser.cpp # Main implementation
β βββ cfgpp_parser.h # C API header
βββ examples/ # LabVIEW integration examples
β βββ labview_example.cpp
β βββ labview_integration_example.cpp
βββ CMakeLists.txt # CMake build configuration
βββ CFGPPParserConfig.cmake.in # CMake package config
See the examples/ directory for complete LabVIEW integration examples and usage patterns.