On Sun, Nov 23, 2003 at 03:08:42PM -0800, William Chops Westfield wrote: > On Sunday, Nov 23, 2003, at 06:26 US/Pacific, Byron A Jeff wrote: > >So here's the problem. The programming software is divided into a set > >of low > >level routines that twiddle the parallel port (vpp_on, bit_on, bit_off > >and the > >like), and the high level routines that read/program the chip using > >the low > >level routines. Since the low level routines are used by every > >programming > >algorithm, and are used for auto chip detection, we are trying to keep > >these > >in the main executable, only moving the high level routines to the > >DLLs. > > > >The problem is how do you make callbacks into the main application's > >low level > >routines from the high level routines in the DLL? > > It sounds a bit backward to me - libraries generally contain the low > level functions, rather than calling low-level functions in the main > code. So making the low level functions another library seems to make > sense (a DLL is still a library, right?) Right. > > However, you COULD use pointers to functions... sorta standard > run-time linkage, I guess: I was looking for a magic bullet that would auto link when the DLL was loaded > > in the DLL: > > static int (*v_vpp_on)(int) = uninitialized_vector_error; > #define VPP_ON(i) (*(v_vpp_on)(i)) > static int (*v_bit_on)(int) = uninitialized_vector_error; > #define BIT_ON(i) (*(v_bit_on)(i)) > static int (*v_bit_off)(int) = uninitialized_vector_error; > #define BIT_OFF(i) (*(v_bit_off)(i)) > > void initialize_vectors (int (*f_vpp)(int) f_vpp, int (*f_vpp)(int) > f_on, > int (*f_vpp)(int) f_off) > { > v_vpp_on = f_vpp; > v_bit_on = f_on; > v_bit_off = f_off; > } > I think I'll simply package the low level stuff into an autolinked DLL so that the symbols are visible to the high level DLL when it is loaded. BAJ -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads