FEniCS / FEniCS/ffcx

MSVC complains about POSIX calls to special math functions e.g. `j0`

Open
#839 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
192
Forks
45
Avg merge
1d 18h
Merged PRs (30d)
17

Description

Claude:

No — _j0 is the opposite problem. The underscore-prefixed names are Microsoft's CRT-specific names; glibc, musl, macOS's libm, and the BSDs don't provide _j0 at all, so your Linux/macOS builds would fail to link.

The standard approach is a small compatibility shim:

```
#include

#if defined(_MSC_VER)
#define BESSEL_J0(x) _j0(x)
#define BESSEL_Y0(x) _y0(x)
#define BESSEL_JN(n, x) _jn((n), (x))
#define BESSEL_YN(n, x) _yn((n), (x))
#else
#define BESSEL_J0(x) j0(x)
#define BESSEL_Y0(x) y0(x)
#define BESSEL_JN(n, x) jn((n), (x))
#define BESSEL_YN(n, x) yn((n), (x))
#endif
```

Not a very nice fix...

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.