cglm icon indicating copy to clipboard operation
cglm copied to clipboard

Is it possible to use CGLM on non-C99 Win32

Open saxondigital opened this issue 5 years ago • 5 comments

I would (very much) like to use CGLM with a non-C99 Win32 app ANTz.

Commonly used (older) versions of MSVC do not support 'inline' C99 methods and most of my users tend to modify the code using such a dev environment (especially VS2012 or perhaps VS2013).

It appears to me that Win32 can work (#51) and that perhaps it is possible to remove 'inline' from the project to allow for this dev environment flexibility?

Any guidance would be appreciated.

cheers, Shane

related issues:

  • #51 glm_vec4_copy segfaults with unaligned memory
  • #13 Can not work on Windows 10 (VS2017)

ps. Perhaps it's worth mentioning that currently most of the libs in the project require at most VS2008 and some are now expecting VS2012, but some HW libs (like AJA) that are bolted in by users (non-open source libs) now expect VS2013.

saxondigital avatar Jul 26 '20 13:07 saxondigital

Hello @saxondigital

Yes I also would like to see that cglm works on any platform and with any toolchains/compilers...

IIRC, I had got alignment issue for MSVC, to fix that alignment has been disabled for older MSVC or Visual Studios versions. So the issue seem to be fixed. But your issue seems different one.

Commonly used (older) versions of MSVC do not support 'inline' C99 methods...

Here how we defined inline (cglm/common.h):

#if defined(_MSC_VER)
#  ifdef CGLM_DLL
#    define CGLM_EXPORT __declspec(dllexport)
#  else
#    define CGLM_EXPORT __declspec(dllimport)
#  endif
#  define CGLM_INLINE __forceinline
#else
#  define CGLM_EXPORT __attribute__((visibility("default")))
#  define CGLM_INLINE static inline __attribute((always_inline))
#endif

as you can see we don't use inline keyword on MSVC but __forceinline as language extension that comes with MSVC. But if you already know that and still not work for you then we can add some preprocessor conditions to check if MSVC can compile inline or not, if not we could provide alternative ways maybe. For instance #define CGLM_INLINE static or similar thing which help to fix the issue on old MSVC versions

Any suggestions?

recp avatar Jul 26 '20 18:07 recp

@saxondigital ping. Is this still valid issue?

recp avatar Jun 29 '21 19:06 recp

The issue is still of interest. I'll turn some attention back to this and report back here with my findings/questions!

saxondigital avatar Jul 03 '21 00:07 saxondigital

Saw this thread after, seems partially related to a request I just made but not completely, I link it anyways:

https://github.com/recp/cglm/issues/224

awsdert avatar Oct 03 '21 20:10 awsdert

@saxondigital ping again ☺️

recp avatar Oct 04 '21 10:10 recp