If you find yourself editing your protk.dat files because you are changing the location of the application or you are using multiple hardware architectures (i.e. Unix and Windows, Win32 and Win64, etc), STOP! Put down the mouse, and slowly step away from the keyboard.
If you use environment variable creatively, you will need one protk.dat file for all of your installations. That's it, just one. Unix and Windows you ask? YES! 32 bit and 64 bit Windows? YES!
The first thing you need to do is to setup an environment variable for the install folder of your application. Call it what you want, but be consistent. I am going to give examples here about the open source Pro/ENGINEER to BRL CAD converter. I'll use the environment variable PROE2BRL_INSTALL for the install folder.
The resulting protk.dat file looks like this:
name PROE2BRL
startup dll
exec_file $PROE2BRL_INSTALL/proe2brl.dll
text_dir $PROE2BRL_INSTALL/text
allow_stop TRUE
end
I know what you're thinking, you think you'll have to change those paths for Windows machines. WRONG! It's a little known secret that Pro/ENGINEER on Windows can handle unix style pathing and environment variable syntax, and not just in protk.dat files. This includes the config.pro file. It may seem strange to those die-hard Windows guys, but it works.
Now the 64 bit Windows guy in the audience (I'll call him Dustin), shouts out "What if we have 32 bit and 64 bit DLL's?!" Well Dustin, no problem there either because Pro/ENGINEER sets some platform specific environment variables that we can use.
We can separate the 32 bit and 64 bit DLL's into two folders. For Windows, this would be "i486_nt" for 32 bit DLL's and "x86e_win64" for 64 bit DLL's. If we plug in the MC environment variable, Pro/ENGINEER uses the correct DLL based on the current architecture.
The resulting protk.dat file looks like this:
name PROE2BRL
startup dll
exec_file $PROE2BRL_INSTALL/$mc/proe2brl.dll
text_dir $PROE2BRL_INSTALL/text
allow_stop TRUE
end
Now the Unix guys, bored with talk of mere a 32 bit application, rant "On Unix, our DLL's are called shared objects and have a .so extension and ... blah blah blah ...". Again, not a problem. If that's a concern, setup another environment variable, let's call it PROE2BRL_EXEC. On Unix this can be set to "proe2brl.so" and on Windows "proe2brl.dll". (Or, just call it "proe2brl.dll" and skip this step)
The resulting protk.dat file looks like this:
name PROE2BRL
startup dll
exec_file $PROE2BRL_INSTALL/$mc/$PROE2BRL_EXEC
text_dir $PROE2BRL_INSTALL/text
allow_stop TRUE
end
In the config.pro, we can use this:
protkdat $PROE2BRL_INSTALL/protk.dat
These techniques get us much closer to the mythical "one install" for all platforms. Also be sure to check out my previous article on how to conditionally load your Pro/Toollkit applications.
Questions and comments are always welcome, either here on my blog or at MarcMettes@InversionConsulting.com.
No comments:
Post a Comment