New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vDSP_ctozD malloc error C++ #16
Comments
To run under a C++ compiler, I think the code in simpletest.c will need a few modifications. I'm not a C++ expert, but I'm certain the return value from If adding the cast doesn't resolve your problem, can you post a full console trace of the compiler errors. |
OK — I have now pushed a fix, which adds these casts to the malloc calls. Hopefully this will resolve your problem. |
same problem, I tried to use a C header with extern "C" statement and then define the function in a .c file. This function is eventually called in a C++ app. Alternatively I've implemented the code directly in my C++ file and in both cases I get the same error. to run the code in C++ I had to change this function: to this: I didn't quite understand why you take the array address by dereferencing the array, I guess it's a C thing, in C++ input should return the address to the first block of memory. any thoughts? thanks for your help. |
OK, I'll take a look at this and try to put together a C++-compatible simpletest. I am busy the rest of the day, but can probably push a fix tomorrow morning. On 14 Mar 2013, at 13:18, Andrea notifications@github.com wrote:
|
I just published the cinder block on github, even though I'm not sure you are familiar with Cinder https://github.com/q-depot/ciLibXtract there is a sample samples/BasicSample which I will use to build the block. At the moment I tried to implement the code in two different way:
does it make sense? |
I'm checking the data type size and I have different results when I print the size of double and double* I guess this might be the problem, please let me know if you have the same opinion or other thoughts. printf( "\n%d %d", sizeof(double), sizeof(double*) ); simpletest.c C++ app |
OK. Regarding your comment:
Yup, this is the same problem as the malloc() issue. C++ compilers won't implicitly cast from
If we declare an array
All this means is that your C compiler is using 64-bits to store pointers to double and your C++ compiler is using 32-bits to store pointers to double. The number of bytes used to store a pointer is implementation defined. I'm not sure what the reason for the difference is in this specific case, but I don't think it's what's causing our problems. |
I'm running the block with the new version of Cinder(app rewrite) and it seems to be working now! thanks again for your help. |
No problem. I'll close this issue now. Please open a new one if you have problems further down the line. |
I'm trying to implement simpletest.c example in c++, the app throws malloc error, while running Guard Malloc the app breaks on vDSP_ctozD called by XTRACT_SPECTRUM, however despite it breaks, it output the data correctly(spectral bins, MFCCs).
The text was updated successfully, but these errors were encountered: