Re: Compiling OpenShadingLanguage under Windows

Oleg <ode...@...>

Nice debugging session... Thanks for the information :-)

Did you try to use the "ShellExecute()" function? Does the
"ShellExecute()" function setup the environment in the right way (or
just not modify the existing one)?

I will try to look into it in the next days.


On 20 Jan., 22:37, Wormszer <wo...@...> wrote:
Hello Oleg,

That's probably a better solution. Will need to go back and make sure the
libraries export their classes rather than duplicating the source in the
I was trying to avoid adding to much to the code for windows, and I was
planning on after hopefully to get it all building, to then do a clean
checkout and do it again and make changes to submit as a patch.

I played around some and finally got a shader to compile.

I have a solution but its not very elegant. The compiler is hard coded to
use linux CPP preprocessor. /usr/bin/CPP
I was able to get it working using CL to do the pre-processing. But I had to
write it to a file and read it back in rather than using stdout.
Its only a few lines of code extra and passes the file handle from the
opened file to the parser instead of the _popen handle.

CL will output to stdout. When i was testing in in the debugger the issue
was that by default the build environment is not setup.
You typically have to run the vcvars32.bat to set it up and that was causing
some issues.

And then i am not positive if the stdout of CL parses correctly, it seems to
insert the filename at the begining, but the file output does.

So maybe we can figure out a better solution to get it working with cl using
stdout. It may work if you run oslc from a command prompt with the vs
variables setup already.
I will try that next, except im expecting the process spawned by _popen
won't have the environment setup correctly. And since it using stdout to
read from then anything you do can't output or it gets parsed.

If you mess with it the parameters to CL i used are /P /C /EP /X /nologo and
then /FI to force the include file. Remove /P if you want stdout instead of


On Wed, Jan 20, 2010 at 4:07 PM, Oleg <od...@...> wrote:
Hi Jeremy,
Did you encounter the same linking issues i mentioned?
Yes, but I've solved them a bit different: just added export macros to
the corresponding classes and "implemented" the "Symbol::mangled ()"
method inline.
Let me know how it works out for you.
I didn't perform any tests so far.
I had tried compiling the shaders after making some changes to the
file for a path issues, but I didnt get any warnings or outputs from
If I tried to run it from the command line, after finding all the
dependencies, it gave me a could not find file error. It didn't seem to
be a
dll error but something else.
I plan to look into it more now.
You received this message because you are subscribed to the Google Groups
"OSL Developers" group.
To post to this group, send email to osl...@....
To unsubscribe from this group, send email to
For more options, visit this group at

Join { to automatically receive all group messages.