* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <config.h>
#include <glib.h>
#include <libsigrok/libsigrok.h>
#include "libsigrok-internal.h"
* sr_driver_list is a special section contains pointers to all the hardware
* drivers built into the library. The __start and __stop symbols are
* auto-generated by the linker (OSX needs a little help) and point to the start
- * and end of the section. They are used to iterate over the list of all
+ * and end of the section. They are used to iterate over the list of all
* drivers.
*/
#ifdef __APPLE__
*
* @param ctx Pointer to a libsigrok context struct. Must not be NULL.
*/
-SR_PRIV void sr_drivers_init(struct sr_context *ctx)
+SR_API void sr_drivers_init(struct sr_context *ctx)
{
- struct sr_dev_driver **drivers;
GArray *array;
array = g_array_new(TRUE, FALSE, sizeof(struct sr_dev_driver *));
- for (drivers = &__start_sr_driver_list; drivers < &__stop_sr_driver_list;
- drivers++)
+#ifdef HAVE_DRIVERS
+ for (struct sr_dev_driver **drivers = &__start_sr_driver_list;
+ drivers < &__stop_sr_driver_list; drivers++)
g_array_append_val(array, *drivers);
+#endif
ctx->driver_list = (struct sr_dev_driver **)array->data;
g_array_free(array, FALSE);
}