Below is an overview of what this exports definition file indicates for SWMM5.DLL, typically found in a Windows DLL export definition (.def
) file. It shows which functions are exported from the SWMM5 dynamic library and what their exported names (including calling conventions) are. In other words, this file tells consumers of SWMM5.DLL which routines they can call.
1. What Is a .def
File?
In Windows development, a Module Definition File (.def
file):
- Lists all exported functions (the routines that can be called externally by programs or other libraries).
- Potentially renames exports (e.g.,
= _swmm_close@0
). - Allows controlling the ordinal and name of each export.
For SWMM5, this .def
file ensures the C API functions of the SWMM engine are visible to external applications.
2. The Export List
LIBRARY SWMM5.DLL
EXPORTS
swmm_close = _swmm_close@0
swmm_decodeDate = _swmm_decodeDate@36
swmm_end = _swmm_end@0
swmm_getCount = _swmm_getCount@4
swmm_getError = _swmm_getError@8
swmm_getIndex = _swmm_getIndex@8
swmm_getMassBalErr = _swmm_getMassBalErr@12
swmm_getName = _swmm_getName@16
swmm_getSavedValue = _swmm_getSavedValue@12
swmm_getValue = _swmm_getValue@8
swmm_getVersion = _swmm_getVersion@0
swmm_getWarnings = _swmm_getWarnings@0
swmm_open = _swmm_open@12
swmm_report = _swmm_report@0
swmm_run = _swmm_run@12
swmm_setValue = _swmm_setValue@16
swmm_start = _swmm_start@4
swmm_step = _swmm_step@4
swmm_stride = _swmm_stride@8
swmm_writeLine = _swmm_writeLine@4
2.1 Library Declaration
LIBRARY SWMM5.DLL
- Declares that the name of the library is
SWMM5.DLL
.
2.2 EXPORTS
Section
- Each line declares a function name, optionally followed by
= _functionName@N
, where:functionName
is how the function is known in user code (the “decorated” name in stdcall).@N
indicates the bytes of parameters on the stack (for example,_swmm_getError@8
typically means an stdcall function with 8 bytes of parameters).- For a C/C++ function using the
__stdcall
convention, the decorated name often looks like_functionName@stackbytes
.
Below are descriptions of each function (these are typical from SWMM5’s C API, although details can vary slightly):
-
swmm_close = _swmm_close@0
Closes the opened SWMM project and frees memory. -
swmm_decodeDate = _swmm_decodeDate@36
Decodes an internal SWMM datetime into year, month, day, hour, minute, second._@36
implies six parameters (6*4=24 bytes) plus possibly a return address, etc.
-
swmm_end = _swmm_end@0
Terminates a simulation after aswmm_start()
. Typically calls internal housekeeping. -
swmm_getCount = _swmm_getCount@4
Returns the number of objects (nodes, links, etc.) in a given category. -
swmm_getError = _swmm_getError@8
Retrieves the last error code/message encountered. -
swmm_getIndex = _swmm_getIndex@8
Retrieves the internal index of a named object (like a node name → index). -
swmm_getMassBalErr = _swmm_getMassBalErr@12
Obtains system mass balance error after a run. -
swmm_getName = _swmm_getName@16
Gets the name of an object from its index/type. -
swmm_getSavedValue = _swmm_getSavedValue@12
Retrieves a saved result (e.g., flow, depth) for an object after or during a run. -
swmm_getValue = _swmm_getValue@8
Gets a current simulation value for some property of a node/link. -
swmm_getVersion = _swmm_getVersion@0
Returns the SWMM engine version code (e.g., 52004). -
swmm_getWarnings = _swmm_getWarnings@0
Returns the number of warning messages encountered. -
swmm_open = _swmm_open@12
Opens an input file and prepares data structures (typical signature:swmm_open(inFile, rptFile, outFile)
). -
swmm_report = _swmm_report@0
Writes the output reports (summary, statistics). -
swmm_run = _swmm_run@12
A convenience function that callsswmm_open()
,swmm_exec()
, andswmm_close()
in one shot. -
swmm_setValue = _swmm_setValue@16
Sets a property for an object in the simulation (e.g., modifies parameters on-the-fly). -
swmm_start = _swmm_start@4
Initializes simulation objects before stepping repeatedly. -
swmm_step = _swmm_step@4
Executes one routing time step in SWMM (returns how much time actually advanced, or 0 if done). -
swmm_stride = _swmm_stride@8
Possibly a variant of step that runs multiple steps at once or steps with a stride approach (depending on SWMM’s version). -
swmm_writeLine = _swmm_writeLine@4
Writes a line of text to the SWMM report or output interface.
3. Why This .def
File Matters
- Windows exports: On Windows,
__stdcall
functions get decorated names, e.g._function@N
. A.def
file can map a simpler C name (swmm_open
) to that decorated name, ensuring external code can import the function by the simpler name. - This file ensures the DLL can be linked properly by external code that calls
swmm_...
functions.
4. Summary
This snippet:
- Declares the library name:
SWMM5.DLL
. - Defines which C API functions SWMM exposes to external software:
- Opening/Closing/Running SWMM simulations,
- Getting/Setting object data (like node flows, index lookups),
- Retrieving error info, version, mass balance, etc.
- Uses the calling convention and decoration typical for
__stdcall
functions on Windows.
Hence, end-users wanting to dynamically link against SWMM5.DLL
can call these functions (like swmm_run
) to control a SWMM simulation, query results, or modify parameters at runtime.
No comments:
Post a Comment