Path: utzoo!attcan!uunet!olivea!decwrl!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!think.com!mintaka!bloom-beacon!eru!hagbard!sunic!news.funet.fi!funic!santra!fuug!tuura!risto From: risto@tuura.UUCP (Risto Lankinen) Newsgroups: comp.windows.ms.programmer Subject: Re: Windows SDK and external functions Message-ID: <971@tuura.UUCP> Date: 28 Jan 91 10:08:17 GMT References: <16458.27a0406a@ul.ie> Organization: Nokia Data Systems Oy Lines: 34 oreillyj@ul.ie writes: >I am currently porting a large amount of 'C' code to the windows environment. >Some of the code uses a plug-in sound card the functions for which are >in an MS C library. When I incorporate calls to these functions in the >windows code two things happen. Firstly the actual function doesn't work >and secondly the system usually crashes. Hi! There are two possible reasons: Either the library routines need to install their own interrupt handler, which moves in memory (while it shouldn't do so) when the other Windows applications allocate memory, or the library routines depend on C start-up code, which is a bit different for the Windows programs from the standard C programs. If the library installs its own interrupt handler, you should declare the segment containing it as FIXED, and probably prevent the same interrupt from being re-vectored by the same program (either calling the routines only from a DLL, which automatically is single-instance, or making your program check the 'hPrevInst' before initializing the library). It is also possible that the library inserts an auto-initialize vector in the XIB -segment, which is part of the standard C start-up code. In this case, the only way to prevent multiple initialization is to call library routines from a DLL and nowhere else. Terveisin: Risto Lankinen -- Risto Lankinen / product specialist *************************************** Nokia Data Systems, Technology Dept * 2 2 * THIS SPACE INTENTIONALLY LEFT BLANK * 2 -1 is PRIME! Now working on 2 +1 * replies: risto@yj.data.nokia.fi ***************************************