You could make it work, if you think about the problem a bit differently. Have your program output a command, like "cd /your/dir", when it exits. Then run it with eval from the shell (assuming a bash shell.)
eval $(yourprogram)
... now, set up an alias:
alias something='eval $(yourprogram)'
and there you go. "something" can now change your directory (and do anything else by echoing a command.)