Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6927899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:06:52+00:00 2026-05-27T11:06:52+00:00

the small example program below is giving me an assertion error (‘settings != NULL’

  • 0

the small example program below is giving me an assertion error (‘settings != NULL’ failed) and I can’t understand why it thinks the settings structure pointer is NULL.

File test.c:

#include <fluidsynth.h>

int main(int argc, char** argv) 
{
    fluid_settings_t* settings = new_fluid_settings();
    fluid_synth_setint(settings, "synth.polyphony", 128); //assertion error
    delete_fluid_settings(settings);
    return 0;
}

Compiled with: gcc test.c -lfluidsynth.

I’ve tried printing the address returned by new_fluid_settings() but it seems a valid address to me.

So I’ve searched through the fluidsynth 1.1.5 source code and find out the line 1213 of the file utils/fluid_settings.c :

fluid_return_val_if_fail (settings != NULL, 0);

But fluid_return_val_if_fail is just a simple macro for calling GLib’s g_return_val_if_fail (utils/fluid_sys.h:59).

Since the settings address is a valid one, I can’t think of something else. Isn’t it true that NULL pointers point to the address 0x00?

Am I forgetting something important ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T11:06:53+00:00Added an answer on May 27, 2026 at 11:06 am

    Print the address before using it, using e.g. printf("the settings are at %p\n", settings);; and you can of course also add protection yourself:

    if (settings != NULL)
    {
      fluid_synth_setint(settings, "synth.polyphony", 128);
    }
    

    If it’s the _new() call that is failing, you need to dig into why that could happen, of course.

    It used to be that you had to manually initialize the glib library that FluidSynth seems to depend on, but that should no longer be necessary.

    I had a brief look, and it seems it tries to initialize a mutex inside the settings object (to make it thread-safe, I assume), so it’s possible that you need to add a call to g_thread_init() to your main(), before the call to new_fluid_settings().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I select the good method (I have in the example below show
I have written a small example C++ program, using boost::thread. Since it's 215 lines,
I have a small example program which simply fopen s a file and uses
I am using Hadoop example program WordCount to process large set of small files/web
I did a small example program to insert data to a MySQL database table
I need some help adding conditions to a linq query. Take this small example
I'm writing a small article on humanly readable alternatives to Guids/UIDs, for example those
One small function of a large program examines assemblies in a folder and replaces
I wrote a small program that uses Mechanize to traverse a site. I want
A small program which loads image and logs its size. It is compiled with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.