Skip to content

Commit 56395c8

Browse files
authored
Merge pull request #2 from korarei/fix/cdef
Fix: Avoid struct name collisions by renaming
2 parents b0b9052 + 532560c commit 56395c8

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

dll_src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ rotate(const std::vector<Vec3d> &input, const Param &param) noexcept {
7373
}
7474

7575
extern "C" int
76-
transform_cam(const CParam *c_param, const CParent *c_parent, const CCam *c_input, CCam *c_output) {
76+
CameraTransform_K(const CParam *c_param, const CParent *c_parent, const CCam *c_input, CCam *c_output) {
7777
if (!c_param || !c_input || !c_parent || !c_output)
7878
return 1;
7979

dll_src/main.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
LIBRARY "CameraTransform_K"
22
EXPORTS
3-
transform_cam
3+
CameraTransform_K

scripts/@CameraTransform_K_template.cam2

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,31 +37,31 @@ pcall(ffi.cdef, [[
3737
double x, y, z;
3838
double rw, rx, ry, rz;
3939
unsigned int rot_mode;
40-
} Param;
40+
} CAMTFKParam;
4141

4242
typedef struct {
4343
int type;
4444
double x, y, z;
4545
double rw, rx, ry, rz;
4646
unsigned int rot_mode;
4747
double scale;
48-
} Parent;
48+
} CAMTFKParent;
4949

5050
typedef struct {
5151
double x, y, z;
5252
double tx, ty, tz;
5353
double ux, uy, uz;
54-
} Cam;
54+
} CAMTFKCam;
5555

56-
int transform_cam(const Param *param, const Parent *parent, const Cam *input, Cam *output);
56+
int CameraTransform_K(const CAMTFKParam *param, const CAMTFKParent *parent, const CAMTFKCam *input, CAMTFKCam *output);
5757
]])
5858

5959
---@class Param : ffi.cdata*
60-
local Param = ffi.typeof("Param")
60+
local Param = ffi.typeof("CAMTFKParam")
6161
---@class Parent : ffi.cdata*
62-
local Parent = ffi.typeof("Parent")
62+
local Parent = ffi.typeof("CAMTFKParent")
6363
---@class Cam : ffi.cdata*
64-
local Cam = ffi.typeof("Cam")
64+
local Cam = ffi.typeof("CAMTFKCam")
6565

6666
local dll_path = obj.getinfo("script_path") .. "CameraTransform_K.dll"
6767
local lib = ffi.load(dll_path)
@@ -89,7 +89,7 @@ local param = Param(x, y, z, rw, rx, ry, rz, rot_mode)
8989
local input = Cam(cam.x, cam.y, cam.z, cam.tx, cam.ty, cam.tz, cam.ux, cam.uy, cam.uz)
9090
local output = Cam()
9191

92-
if (lib.transform_cam(param, parent, input, output) ~= 0) then
92+
if (lib.CameraTransform_K(param, parent, input, output) ~= 0) then
9393
error("Camera transformation failed.")
9494
end
9595

0 commit comments

Comments
 (0)