Skip to content

Commit

Permalink
conditionally include __declspec to function definition to fix Window… (
Browse files Browse the repository at this point in the history
facebookresearch#1584)

Summary:
…s DLL exports.

# Before submitting

- [x] Was this discussed/approved via a Github issue? (no need for typos, doc improvements)
- [x] Did you read the [contributor guideline](https://github.com/pytorch/fairseq/blob/master/CONTRIBUTING.md)?
- [x] Did you make sure to update the docs?
- [x] Did you write any new necessary tests?

## What does this PR do?
Fixes facebookresearch#292

☝️ technically this issue should remain open

## PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.

## Did you have fun?
👍
Pull Request resolved: facebookresearch#1584

Differential Revision: D19289792

Pulled By: myleott

fbshipit-source-id: 96af49e2ed808dde3f682906bc2d6e074b522c39
  • Loading branch information
erip authored and facebook-github-bot committed Jan 6, 2020
1 parent bf79548 commit 52c6db9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions fairseq/clib/libbleu/libbleu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,16 @@ void bleu_addngram(

extern "C" {

#ifdef _WIN64
__declspec(dllexport)
#endif
void bleu_zero_init(bleu_stat* stat) {
std::memset(stat, 0, sizeof(bleu_stat));
}

#ifdef _WIN64
__declspec(dllexport)
#endif
void bleu_one_init(bleu_stat* stat) {
bleu_zero_init(stat);
stat->count1 = 0;
Expand All @@ -114,6 +120,9 @@ void bleu_one_init(bleu_stat* stat) {
stat->match4 = 1;
}

#ifdef _WIN64
__declspec(dllexport)
#endif
void bleu_add(
bleu_stat* stat,
size_t reflen, int* ref, size_t predlen, int* pred, int pad, int eos) {
Expand Down

0 comments on commit 52c6db9

Please # to comment.