CATIA CAA API Help – 6

Setting Environment Variable Programatically
Subject : Setting Environment Variable Programatically

Maybe your invocation of CATPutEnv does the right thing just a bit late for your DLL. Problem with finding your DLL when you use CATPutEnv to modify CATDllPath is that all DLL reference resolved at the application load time, whereas you calling CATPutEnv at application run time which happens after loading application. So run time comes after load time and henece your DLL is unresolved. The difference with using “Runtime Environment Variable..” option is that the setting of this option is taken into account at the CATIA load time.
Hope this helps.

Original message :
Hi, I would appreciate if somebody can tell me how to set the environment variable programmatically. I tried using CATPutEnv(const char* xyz) function, but it doesn’t seems to work properly, The documentation of CATPutEnv says that the environment variable string must be in the form of Name=Value and it must be GLOBAL TO THE PROCESS. I create a string on the heap and pass the pointer to this function. If I use “GetEnvValue” function to get the value of the same environment variable that I have set, it gives me correct value as if it has been set correctly. But I don’t see the desired behavior inside CATIA. What I want to do is, I want to run a command, which is implemented inside a dll, and that dll is lying at a certain path. I want to set the CATDLLPath environment variable to this directory where the dll is lying. If I set the same environment variable through the “Runtime Environment Variable…” of the development studio, It works fine…. I shall highly appreciate any help. Thanks and regards, Nitin

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s