Skip to content

Commit bd218af

Browse files
committed
Add proper namespace to c++ bridge functions
1 parent 9163b6c commit bd218af

File tree

5 files changed

+10
-2
lines changed

5 files changed

+10
-2
lines changed

Diff for: build.rs

-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ fn main() -> io::Result<()> {
4141
.unwrap();
4242
}
4343

44-
4544
println!("cargo:rustc-link-search=native={}", bundle_dir.display());
4645
println!("cargo:rustc-link-lib=static=clockkit");
4746

Diff for: examples/clockkit.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
server:192.168.178.37
1+
server:127.0.0.1
22
port:4444
33
timeout:2000
44
phasePanic:10000

Diff for: include/ClockKit/bridge.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include <random>
1010
#include <utility>
1111

12+
namespace bridge {
13+
1214
std::pair<dex::PhaseLockedClock*, dex::ClockClient*> buildClock(ConfigReader config)
1315
{
1416
auto cli = new dex::ClockClient(kissnet::endpoint(std::string(config.server), config.port));
@@ -41,3 +43,4 @@ void setUpdatePanic(std::shared_ptr<dex::PhaseLockedClock> clock, int64_t micros
4143
clock->setUpdatePanic(val);
4244
}
4345

46+
} // ns bridge

Diff for: include/ClockKit/bridge.h

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#pragma once
22
#include "PhaseLockedClock.h"
33

4+
namespace bridge {
5+
46
struct ConfigReader;
57

68
std::shared_ptr<dex::PhaseLockedClock> buildPLC(ConfigReader config);
@@ -10,3 +12,5 @@ int64_t getValue(std::shared_ptr<dex::PhaseLockedClock> clock);
1012
void setPhasePanic(std::shared_ptr<dex::PhaseLockedClock> clock, int64_t micros);
1113

1214
void setUpdatePanic(std::shared_ptr<dex::PhaseLockedClock> clock, int64_t micros);
15+
16+
} // ns bridge

Diff for: src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ mod ffi {
6363
/// .server("10.10.10.20".to_string())
6464
/// .port(1234)
6565
/// .build_clock();
66+
#[namespace = "bridge"]
6667
struct ConfigReader {
6768
server: String,
6869
port: u16,
@@ -71,6 +72,7 @@ mod ffi {
7172
updatePanic: u32,
7273
}
7374

75+
#[namespace = "bridge"]
7476
unsafe extern "C++" {
7577
include!("clockkit/include/ClockKit/bridge.h");
7678

0 commit comments

Comments
 (0)