/* CSound API driver showing the segmentation fault in oload. 2003 Oct 09. On Windows 2000, install MinGW and then MSYS. Place sources from the csound module of the SourceForge csound CVS repository in a directory. Add in this file (driver.c), the accompanying Makefile, and knowing.csd. The URL for knowing.csd is: http://www.ccs.neu.edu/home/ramsdell/papers/knowing/knowing.csd Compile and run the program with DEFS = -DSSOUND by typing: $ make Run the program using gdb. After multiple trials, you should see: $ gdb driver.exe GNU gdb 5.2.1 Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i686-pc-mingw32"... (gdb) run knowing.csd Starting program: C:\opt\msys-1.0\home\Administrator\bug\mix/driver.exe knowing.csd Program received signal SIGSEGV, Segmentation fault. 0x0040dd6d in oload () at oload.c:391 391 MYFLT conval = pool[inoffp->indx[0] - 1]; (gdb) bt #0 0x0040dd6d in oload () at oload.c:391 #1 0x00406fff in musmon () at musmon.c:242 #2 0x00402409 in csoundMain (csound=0x528700, argc=1, argv=0x3f2520) at main.c:600 #3 0x0050cfda in csoundPerform (csound=0x528700, argc=2, argv=0x3f2520) at csound.c:147 #4 0x0050f4c4 in main (argc=2, argv=0x3f2520) at driver.c:78 (gdb) */ #include #include #include "csound.h" static void wxcsound_message(void *csound, const char *format, va_list args) { vprintf(format, args); } void csoundMessage0(const char *format, ...) { va_list args; va_start(args, format); wxcsound_message(0, format, args); va_end(args); } static int wxcsound_poll_events(void *csound) { return 1; } static const int n = 20; int main(int argc, char **argv) { int i, rc; void *csound = csoundCreate(0); csoundSetMessageCallback(csound, wxcsound_message); csoundSetIsGraphable(csound, 0); csoundSetYieldCallback(csound, wxcsound_poll_events); for (i = 0; i < n; i++) { printf("Starting trial number %d\n", i + 1); rc = csoundPerform(csound, argc, argv); if (rc) return rc; csoundCleanup(csound); csoundReset(csound); } printf("Finished %d trials\n", n); return rc; }