16a0 Subj : Re: Continuuing - how to build a library To : borland.public.cpp.borlandcpp From : D Kat Date : Tue Oct 12 2004 06:42 pm ///// ISR in LIBRARY void __interrupt i_service(...)// Daq801 interrupt service routine { disable(); // disable the interrupts int button,i; // button iterator unsigned char PA_buttons,PC_buttons; // temp holding register for current buttons inp(I_STATUS); // read the interrupt status register and clear interrupt for (i=0;i fill buffer } outpw(DA_0,*da_point); outpw(DA_1,*da_point++); } if (BUTTONFLAG) { PA_buttons=(inp(PA)); // freeze data if (PA_buttons != MASK)// process following path only if one or more { // buttons were pressed! for (button=0;button 0) while (counter[0] <((unsigned long) samples + MAXWAIT)) if (press_count==num_sub) { BUTTONFLAG = 0; lcd_clear(); lcd_str("*****",18,3); return 1; } if (num_sub>0) BUTTONFLAG = 0; lcd_clear(); lcd_str("*****",18,3); return 0 ; //********************************************************************************** "D Kat" wrote in message news:416c48dc$1@newsgroups.borland.com... > Well I have a great deal of what I want done worked out thanks to the > responses. I have run up against a wall though that I don't know how to > handle. > > I am using the some identical variables and Constants in both the Library > and in the programs that call the library. > > The Constants I can get around by just declaring new ones within the > program being used - so I make an Include file that uses different names > that have the same values.. so I can work around that. BUT what I can't > figure out is how to handle the arrays that must be used from both the > main program and the Library. Of greatest issue is the double array that > reads in the sound file that then gets played through the library routine. > Do I have to pass everything through the routines that are called or is > there some way to declare them that they can be shared? Given that the > double array opened in the main program is being accessed in the ISR I > can't wrap my head around how this is shared.... (I am double buffering > and the buffer is assigned in the main program)... Am I making sense? > > > > "D Kat" wrote in message > news:4162e80f$1@newsgroups.borland.com... >>I cannot for the life of me find how to build a library in any of my >>builder books or the help window.... I used to know how with the old Unix >>compiler but have now forgotten. I'm not even sure I should be building a >>library vs another .cpp file that is loaded with the main.cpp file as an >>.obj. A library would be better though for how I want it to look for the >>people who will be using it. >> >> What I have are some functions that initialize and use an IO board. >> These functions never change and it is confusing for the students to have >> to include them in the programs they have to write. We have reached >> critical mass in our lab and to simplify I want these routines to >> function much as any other C function would. That is make the source >> code invisible to the user but the functions themselves easily accessible >> by just including a library or linking to an object file. >> >> I can't even remember if I have to have a Main() for a lib.... so that >> is where I am at and if someone can point me in the right direction or >> give me a simple run down, it would be appreciated. >> > > . 0