snowdust
2008-08-06 18:10:08 UTC
I have a Visual Basic ActiveX DLL with several functions including Init and RWReg. Init creates a new class instance and does some initialization. RWReg calls functions from the class to read/write some hardware registers. I have also created Init.vi and RWReg.vi. These are wrappers around the Init and RWReg ActiveX method calls (see attached init.pdf for example). Here's my problem: When I call Init.vi and RWReg.vi in succession and wire the refnum output of init.vi to the refnum input of RWReg.vi directly everything works fine and I can read/write registers. On the other hand, when I pass the refnum from Init.vi to RWReg.vi via a local variable (see attached refnum_problem.pdf), I get the following error:Code1: Incorrect function. in cvg_RWReg.viI've tried passing the refnum using global variables and functional global variables with the same result. It appears to me that unless the refnums are hardwired between separate VI calls, Labview clears the DLL from memory. Is there a way to get around this? I would like to be able to call Init.vi to initialize the class, then to be able to call RWReg.vi separately to read/write registers once the Init.vi has closed. Can I accomplish this without hardwiring the refnums? Would I have the same issue (DLL cleared from application memory after VI closes) if I had a standard Windows DLL instead of an ActiveX DLL? Thanks,Dan
init.pdf:
http://forums.ni.com/attachments/ni/170/347213/1/init.pdf
refnum_problem.pdf:
http://forums.ni.com/attachments/ni/170/347213/2/refnum_problem.pdf
init.pdf:
http://forums.ni.com/attachments/ni/170/347213/1/init.pdf
refnum_problem.pdf:
http://forums.ni.com/attachments/ni/170/347213/2/refnum_problem.pdf