Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Audio Library Pre-Processor Help  (Read 2932 times)

0 Members and 1 Guest are viewing this topic.

EvanM

  • Newbie
  • *
  • Posts: 2
    • View Profile
Audio Library Pre-Processor Help
« on: November 29, 2018, 10:47:06 pm »
#ifndef AL_AL_H
#define AL_AL_H

#if defined(__cplusplus)
extern "C" {
#endif

#ifndef AL_API
 #if defined(AL_LIBTYPE_STATIC)
  #define AL_API
 #elif defined(_WIN32)
  #define AL_API __declspec(dllimport)
 #else
  #define AL_API extern
 #endif
#endif

#if defined(_WIN32)
 #define AL_APIENTRY __cdecl
#else
 #define AL_APIENTRY
#endif
 

This is probably a simple question but I have been struggling to understand the first 22 lines of al.h in SFML/extlibs/headers/AL/al.h. Specifically line 9, or #if defined(AL_LIBTYPE_STATIC). I am not seeing AL_LIBTYPE_STATIC ever being defined in this whole SFML project, where is this coming from? Is this something that comes up through the linker? What are these lines doing? I understand preprocessor directives and their use but this is something I have not quite seen before. Thanks.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Audio Library Pre-Processor Help
« Reply #1 on: November 30, 2018, 12:05:55 am »
This is the header for OpenAL, I'm not quite sure why you're trying to understand it, i.e. what's your goal here?

Regardless, the define isn't used anywhere in SFML, because we're not supporting static linking of OpenAL due to LGPL licensing issues.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

EvanM

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Audio Library Pre-Processor Help
« Reply #2 on: November 30, 2018, 03:50:40 pm »
Lately, I've been going back over c++ to get a real fundamental understanding of what is happening and why certain methods are used. There is no goal, I just like knowing everything that happens in a piece of code (low-level understanding). From what I have been able to dig up, AL_LIBTYPE_STATIC is defined in the pre-processor settings in microsoft VS if using a static library. These pre processor directives check to see if this is defined or not when the project is built, if it isn't it tries to check if there is a dynamic library defined. I am not really concerned with licensing as this is a more read and learn project.