In the C binding, object creation is split into two calls — allocation and initialization — to distinguish running out of memory from other errors: …Alloc returns a null pointer if there is no memory, and initialization — PmtaConnConnectRemote, PmtaMsgInit, PmtaRcptInit — reports everything else.
When done, the object is freed with an …Free function; freeing a connection also closes it. A recipient is always freed — even after it is added to a message, otherwise memory leaks.
Hence the difference in size: there are more functions in the C section than methods in the C++ section, but the extra ones manage object lifetimes and query errors rather than adding capabilities.
Three steps for a connection and a message:
| Step | Connection | Message |
|---|---|---|
| allocate | PmtaConnAlloc | PmtaMsgAlloc |
| initialize | PmtaConnConnectRemote | PmtaMsgInit |
| free | PmtaConnFree | PmtaMsgFree |
# a connection from allocation to freeing PmtaConn conn = PmtaConnAlloc(); if (!PmtaConnConnectRemote(conn, "127.0.0.1", 25)) puts(PmtaConnGetLastError(conn));PmtaConnFree(conn);
0 relations
C submission APIA related mechanism: they work together. § 7.5.1
grep -n 'PmtaConnFree' /opt/pmta/api/include/submitter/PmtaConn.h