Here is one possibility :
typedef double (*_swe_julday)( int, int, int, double, int );
typedef int (*_swe_calc)( double, int, int, double[], char[] );
typedef void (*_swe_revjul)( double, int, int&, int&, int&, double& );
class SWE
{
public:
static inline _swe_julday JulDay = nullptr;
static inline _swe_calc Calc = nullptr;
static inline _swe_revjul RevJul = nullptr;
static bool Initialize()
{
if( m_Initialized )
return true;
HINSTANCE hInst = LoadLibrary( _T( "swedll64.dll" ) );
if( ! hInst )
return false;
JulDay = reinterpret_cast<_swe_julday>( GetProcAddress( hInst, "swe_julday" ) );
Calc = reinterpret_cast<_swe_calc>( GetProcAddress( hInst, "swe_calc" ) );
RevJul = reinterpret_cast<_swe_revjul>( GetProcAddress( hInst, "swe_revjul" ) );
m_Initialized = true;
return true;
}
static bool IsInitialized() const { return m_Initialized; }
protected:
static inline bool m_Initialized = false;
};
This might look weird because there is some C++17 stuff in there but it will compile and link with VS17. I tried it. To use this the code would like this:
SWE::Initialize();
SWE::JulDay( int1, int2, int3, double1, int4 );
One thing to note is a class with all static methods and members is essentially the same thing as having those functions and data in a namespace. Even the usage syntax is the same.