I'm not really much into subdomains. But, the point should be: if your subdomains' /cgi-bin/ aliases point to different directories, then you cannot use this. If virtual() can use http://server/cgi-bin/..., try it. If not, I don't know.
Maybe this:
subdomain1's cgi-bin: /dir1/
subdomain2's cgi-bin: /dir2/
CGI script you're calling: /dir1/script.cgi
In subdomain1, you use "/cgi-bin/script.cgi".
Now, in /dir2/ create symbolic link (named "script.cgi") to "/dir1/script.cgi". Now try calling "/cgi-bin/script.cgi" on subdomain2.
I repeat: these are just guesses. I'm far from being experienced in this stuff.