Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复-b参数解析错误 #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,33 @@ gcc ./modbus_server/modbus_server.c -I./common -I./libmodbus/src/ -L./libmodbus/
running
=======


# 静态编译modbuslib
```
cd libmodbus

参考 MEADME

./configure --enable-static
make
make insatll
```

# 设置动态搜索路径为当前运行目录
```
gcc ./modbus_client/modbus_client.c -I./common -I./libmodbus/src/ -L./libmodbus/src/.libs/ -lmodbus -Wl,-rpath,. -o mbClient

gcc ./modbus_server/modbus_server.c -I./common -I./libmodbus/src/ -L./libmodbus/src/.libs/ -lmodbus -Wl,-rpath,. -o mbServer

将libmodbus.so.5放入程序执行目录
```

# 编译静态链接库
```
gcc ./modbus_client/modbus_client.c -I ./common -I ./libmodbus/src -l:libmodbus.a -o modbus_client
gcc ./modbus_server/modbus_server.c -I ./common -I ./libmodbus/src -l:libmodbus.a -o modbus_server
```

If modbus libraries are not in a default location (either it's needed to move libraries to app location or set
appropriate environment variable):
- on linux it would be:
Expand Down
2 changes: 1 addition & 1 deletion common/mbu-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ int setRtuParam(void *backend, char c, char *value) {
switch (c) {
case 'b': {
rtuParams->baud = getInt(value, &ok);
if (0 != ok) {
if (0 == ok) {
printf("Baudrate is invalid %s", value);
ok = 0;
}
Expand Down