From 52c6db927fd71d3d72bf708d7068c10564505513 Mon Sep 17 00:00:00 2001 From: Elijah Rippeth Date: Mon, 6 Jan 2020 11:10:32 -0800 Subject: [PATCH] =?UTF-8?q?conditionally=20include=20=5F=5Fdeclspec=20to?= =?UTF-8?q?=20function=20definition=20to=20fix=20Window=E2=80=A6=20(#1584)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 https://github.com/pytorch/fairseq/issues/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: https://github.com/pytorch/fairseq/pull/1584 Differential Revision: D19289792 Pulled By: myleott fbshipit-source-id: 96af49e2ed808dde3f682906bc2d6e074b522c39 --- fairseq/clib/libbleu/libbleu.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fairseq/clib/libbleu/libbleu.cpp b/fairseq/clib/libbleu/libbleu.cpp index d95bef2de7..3cf2d65b6d 100644 --- a/fairseq/clib/libbleu/libbleu.cpp +++ b/fairseq/clib/libbleu/libbleu.cpp @@ -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; @@ -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) {