delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/20/02:16:41

From: bdarnell AT vnet DOT net (Ben Darnell)
Newsgroups: comp.os.msdos.djgpp
Subject: Mikmod problems and symify wierdness (long)
Date: Mon, 20 Jan 1997 03:45:16 GMT
Organization: Vnet Internet Access, Inc.
Lines: 76
Message-ID: <32e2e995.11893177@news.vnet.net>
NNTP-Posting-Host: vts-char2-s14.vnet.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I am trying to use Mikmod (version 2.09b), but I'm having some
problems.  This is the code I am using:
-----------------------------mod.c-----------------------------------
#include <stdio.h>
#include <conio.h>
#include <mikmod.h>

void tickhandler()
{
	MP_HandleTick();
	MD_SetBPM(mp_bpm);
};

int main()
{
        UNIMOD* mod;
	md_mixfreq=44100;
	md_dmabufsize=10000;
	md_mode=DMODE_16BITS|DMODE_STEREO;
	md_device=0;
        ML_RegisterLoader(&load_uni);
        MD_RegisterDriver(&drv_sb);
        MD_RegisterPlayer(tickhandler);
        if (!MD_Init()) return 1;

        mod=ML_LoadFN("test.uni");
        if (!mod) return 1;
        MP_Init(mod);
        md_numchn=mod->numchn;
	puts("spam, eggs, sausage and spam"); /* 27 */
        MD_PlayStart();                       /* 28 */
        puts("i don't like spam");            /* 29 */
                                              /* 30 */
        while (!(MP_Ready()||kbhit()))        /* 31 */
		MD_Update();
        MD_PlayStop();
        ML_Free(mod);
	MD_Exit();
	return 0;
};
--------------------------------------------------------
When I compile (with -g and -Wall, no other switches) and run it, it
crashes.  Here is the symify'd output:
----------------------error.log-----------------------------------
Exiting due to signal SIGSEGV
General Protection Fault at eip=0000aa3a
eax=00000000 ebx=0005f320 ecx=000009c4 edx=00002710 esi=00000054
edi=7cbf0bf0
ebp=0005d1e4 esp=0005d1e0 program=F:\MOD\MOD.EXE
cs: sel=00af  base=8343c000  limit=001dffff
ds: sel=00b7  base=8343c000  limit=001dffff
es: sel=00b7  base=8343c000  limit=001dffff
fs: sel=0087  base=00028940  limit=0000ffff
gs: sel=00c7  base=00000000  limit=ffffffff
ss: sel=00b7  base=8343c000  limit=001dffff

Call frame traceback EIPs:
  0x0000aa3a _memset+46
  0x00005974 _ML_LoadFN+2144
  0x00003f86 _MD_PlayStart+22
  0x00001659 _main+181, line 29 of mod.c
  0x0000905e ___crt1_startup+138
spam, eggs, sausage and spam
-----------------------------------------------------------
There appear to be several problems with this traceback: (a)
MD_PlayStart is called on line 28, not 29, (b) MD_PlayStart doesn't
call ML_LoadFN, and (c) ML_LoadFN doesn't call memset.  The first
puts() is reached, but the second one isn't (I assume it comes after
the traceback because stdout is buffered)  I have looked at the sample
program, mikmod.c, but I don't see anything I'm missing.  What's going
on here?
     __                         __
 /> /_ /| /   /\  /|  />  /| / /_ /  /
/> /_ / |/   /_/ /-| / \ / |/ /_ /_ /_
http://users.vnet.net/bdarnell
bdarnell AT vnet DOT net

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019