Registry / networking / libmodbus

libmodbus

JSON →
library3.1.11vcpkgunverified

libmodbus is a free software library to send/receive data with a device which respects the Modbus protocol.

vcpkg install libmodbus
INSTALL
IMPORT
SIG · LIBMODBUS
L
libmodbus
networkingcppv3.1.11
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

modbus/modbus.h
#include <modbus/modbus.h>

Read Modbus registers from a TCP device

#include <modbus/modbus.h> #include <stdio.h> int main() { modbus_t* ctx = modbus_new_tcp("127.0.0.1", 502); if (ctx == NULL) { fprintf(stderr, "Unable to create Modbus context\n"); return 1; } uint16_t tab_reg[32]; int rc = modbus_read_registers(ctx, 0, 10, tab_reg); if (rc == -1) { fprintf(stderr, "%s\n", modbus_strerror(errno)); } modbus_free(ctx); return 0; }
Debug
Known issues
gotchalibmodbus is a C library; C++ wrappers may be needed for RAII.
fix
Use a C++ wrapper or manage resources manually with modbus_free().
affects: *
Upgrade
Version history
3.1.11latest on vcpkg
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources

No resource links recorded.

libmodbus — pip install libmodbus · libregistry