Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting environment variables and making DLL function calls

Status
Not open for further replies.

cunsanfran

Programmer
Jan 18, 2001
3
0
0
US
Situation: We have developed a custom set of client "C" DLLs that connect to an off the shelf middleware product (Tuxedo, TopEnd). We have several test programs (drivers) some written in VB and some written in "C". There are environment variables that are set by the test program at run time. The "SetEnvironmentVariable" (kernel32 api call) is used to accomplish this. Several transactions are entered sequentially from an input file. The environmental settings are changed between transactions.

Problem: The VB test program sets an environment variable, runs the first transaction (calls the client "C" DLL) and works no problem. The VB test program changes the environment variable and runs the second transaction and the "C" DLL does not recognize that the environment has changed. It appears that the environment that is present when the first DLL call is made is resident until the VB test program is shut down. When the VB test program is replaced with its equivalent written in "C" , the DLL recognizes the first and subsequent changes to the environment variable.

Question: Is this a limitation or is there a way to get around this in VB? The "C" driver works but as a curious VB programmer I would like to know if there is something I have overlooked. I can supply sample "C" and VB code that will demonstrate this problem if anyone is interested.

James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top