Skip to content

Commit 4cfa638

Browse files
bshethmetafacebook-github-bot
authored andcommitted
add get_version() for c_api. (#3688)
Summary: Pull Request resolved: #3688 Looks like our previous changes only modified the cpp API. Not the c_api like the request wanted. This attempts to add faiss_get_version to c_api Reviewed By: ramilbakhshyiev Differential Revision: D60207739 fbshipit-source-id: 07184aeae92a154bb3f440279595077f002851f3
1 parent 6e1f23f commit 4cfa638

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

c_api/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ set(FAISS_C_SRC
3030
index_io_c.cpp
3131
impl/AuxIndexStructures_c.cpp
3232
utils/distances_c.cpp
33+
utils/utils_c.cpp
3334
)
3435
add_library(faiss_c ${FAISS_C_SRC})
3536
target_link_libraries(faiss_c PRIVATE faiss)

c_api/utils/utils_c.cpp

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* Copyright (c) Facebook, Inc. and its affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
// Copyright 2004-present Facebook. All Rights Reserved.
9+
// -*- c++ -*-
10+
11+
#include "utils_c.h"
12+
#include <faiss/Index.h>
13+
14+
const char* faiss_get_version() {
15+
return VERSION_STRING;
16+
}

c_api/utils/utils_c.h

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* Copyright (c) Facebook, Inc. and its affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
// Copyright 2004-present Facebook. All Rights Reserved.
9+
// -*- c -*-
10+
11+
#ifndef FAISS_UTILS_C_H
12+
#define FAISS_UTILS_C_H
13+
14+
#include <stdint.h>
15+
#include <stdlib.h>
16+
17+
#ifdef __cplusplus
18+
extern "C" {
19+
#endif
20+
21+
const char* faiss_get_version();
22+
23+
#ifdef __cplusplus
24+
}
25+
#endif
26+
27+
#endif

0 commit comments

Comments
 (0)