oreillyj@ul.ie (01/25/91)
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. Now I am not sure whether the problem is with the functions I am using or is some quirk of the windows system. When compiled to run under DOS there are no problems. Any pointers at all woul all would be appreciated. John O'Reilly, email: oreillyj@ul.ie
risto@tuura.UUCP (Risto Lankinen) (01/28/91)
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 ***************************************