Skip to content

Commit

Permalink
Add OPC_API prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
wiktor-k committed Dec 7, 2023
1 parent 2f7311e commit 24a0aea
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use std::env;
fn main() {
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
let mut config: cbindgen::Config = Default::default();
config.after_includes = Some("#define OPC_API".into());
config.export.prefix = Some("opc_".into());
config.function.prefix = Some("OPC_API".into());
config.language = cbindgen::Language::C;
cbindgen::generate_with_config(crate_dir, config)
.unwrap()
Expand Down
17 changes: 8 additions & 9 deletions openpgp_cards.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#define OPC_API

typedef enum opc_CCardError {
Success,
Expand All @@ -13,18 +12,18 @@ typedef struct opc_CCard opc_CCard;

typedef struct opc_CCards opc_CCards;

enum opc_CCardError opc_scan_for_cards(struct opc_CCards **cards);
OPC_API enum opc_CCardError opc_scan_for_cards(struct opc_CCards **cards);

uintptr_t opc_get_cards_len(const struct opc_CCards *cards);
OPC_API uintptr_t opc_get_cards_len(const struct opc_CCards *cards);

const struct opc_CCard *opc_get_card(const struct opc_CCards *cards, uintptr_t card_id);
OPC_API const struct opc_CCard *opc_get_card(const struct opc_CCards *cards, uintptr_t card_id);

const uint8_t *opc_get_card_ident(const struct opc_CCard *card);
OPC_API const uint8_t *opc_get_card_ident(const struct opc_CCard *card);

const uint8_t *opc_get_card_sig_fpr(const struct opc_CCard *card);
OPC_API const uint8_t *opc_get_card_sig_fpr(const struct opc_CCard *card);

const uint8_t *opc_get_card_dec_fpr(const struct opc_CCard *card);
OPC_API const uint8_t *opc_get_card_dec_fpr(const struct opc_CCard *card);

const uint8_t *opc_get_card_aut_fpr(const struct opc_CCard *card);
OPC_API const uint8_t *opc_get_card_aut_fpr(const struct opc_CCard *card);

void opc_free_cards(struct opc_CCards *cards);
OPC_API void opc_free_cards(struct opc_CCards *cards);
1 change: 1 addition & 0 deletions sample.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#define OPC_API
#include "openpgp_cards.h"
#include <stdio.h>

Expand Down

0 comments on commit 24a0aea

Please sign in to comment.