got it all compiled, i got it to run BUT

Jul 23, 2013 at 5:55 PM
isn't there a way that you do not have to have all the dlls in the same directory as the executable for v8 to run? Could you create a x86 only clearscript.dll with reference to clearscriptv8-32.dll? Would clearscriptv8-32.dll find v8-ia32.dll if it was in the same directory or at least if you have the path in the environment variable path?

I am totally gassed about this project and was real excited when I read it is targeting the 4.0 framework. I got everything to compile using vs10 except for the clearscriptv8-XX.dll because of the atomic stuff you got in there. Is there any way possible to rewrite that part so I can compile it in vs10 express? I did get vs12 installed without any hassle this time but am a little concerned as a commercial developer if I can distribute or not with stuff compiled in vs12. Seems a little absurd with a project with such a liberal license being hampered.

I'LL BE BACK WITH FEEDBACK!!! This project is just so perfect for my needs I couldn't of spec'd it out myself and gotten more on target. I can keep my legacy customers scripting in vbscript and force my new customers to experience turbocharged javascript.
Coordinator
Jul 25, 2013 at 11:14 PM
Hello notahack!

We'll try to answer your questions one by one.

isn't there a way that you do not have to have all the dlls in the same directory as the executable for v8 to run?

Currently ClearScript attempts to load auxiliary V8 DLLs from the following directories:

  1. The directory from which ClearScript.dll was loaded.
  2. AppDomain.CurrentDomain.BaseDirectory.
  3. The directories specified by AppDomain.CurrentDomain.RelativeSearchPath.
  4. The directories specified by the PATH environment variable (v8-ia32.dll and v8-x64.dll only).
This supports common scenarios for desktop and ASP.NET web applications. Do you have a specific alternative directory layout in mind?

Could you create a x86 only clearscript.dll with reference to clearscriptv8-32.dll?

Not without a lot of refactoring. Currently ClearScriptV8-xx.dll depends on ClearScript.dll, not the other way around. This is despite the fact that the latter loads the former. It's similar to a service provider architecture or extension mechanism.

That said, why would you want to do that? If you're trying to minimize DLL count in a 32-bit ClearScript/V8 application, you can simply exclude the 64-bit DLLs.

Would clearscriptv8-32.dll find v8-ia32.dll if it was in the same directory or at least if you have the path in the environment variable path?

Yes, that's how it works today.

I got everything to compile using vs10 except for the clearscriptv8-XX.dll because of the atomic stuff you got in there. Is there any way possible to rewrite that part so I can compile it in vs10 express?

Yes, it would be possible. ClearScriptV8 uses only a handful of the C++11 features that VS2012 implements. Things like atomics and mutexes could be replaced with native Win32 facilities. Our goal however is to use standard C++ features wherever possible in order to gradually enhance ClearScript's portability.

I did get vs12 installed without any hassle this time but am a little concerned as a commercial developer if I can distribute or not with stuff compiled in vs12. Seems a little absurd with a project with such a liberal license being hampered.

Hampered how? As far as we can tell, VS2010 and VS2012 can both be used for commercial development, and both provide redistributable C++ libraries. Why are you more concerned about using VS2012 than VS2010?

Cheers!
Jul 26, 2013 at 3:51 AM
You are a pretty good guy. If anybody bad mouths you send them to me, I'll set em straight.

I worked pretty much all day in integrating this into my project. When I installed 2012 express there was a message that said it was for evaluation only and there was a prompt if it was going to be used for commercial purposes. 2010 express did not have any of those chillers in it's license.

Currently ClearScript attempts to load auxiliary V8 DLLs from the following directories:

The directory from which ClearScript.dll was loaded.
(doesn't seem to work in my case. This would be ideal. Actually it has to be this way since exes and processes that will consume the scripting dlls will not be in the same directory )
AppDomain.CurrentDomain.BaseDirectory.
The directories specified by AppDomain.CurrentDomain.RelativeSearchPath.
The directories specified by the PATH environment variable (v8-ia32.dll and v8-x64.dll only).
Currently I have a directory I put all my application dlls in. I also have this directory in my path variable. All the necessary clearscript dlls are there.

I have a console project that I browse to the directory and add a reference to clearscript.dll.

The console program will not run unless all the clearscript dlls are in its bin/release directory.

That is why I thought all the clearscript dlls have to be in the same directory as the executable.

Another problem I am having is I put strong keys in all my dlls and while I can put one in clearscript.dll without any problem, I don't know how to put one in the clearscriptV8 c++ dlls. I assume the compiled v8 dlls don't matter as far as strong keys.
Jul 26, 2013 at 4:56 PM
I am in a state of bliss because I got clearscript to work in my project.

My final hurdle was since my dll that would reference clearscript.dll was strong keyed clearscript.dll, clearscriptv8-32.dll,clearscriptv8-64.dll had to have strong keys as well. Maybe this is old hat to everyone but I like sharing what I have learned.

I started Windows SDK 7.1 command prompt

sn -k mystrongname.snk

sn -p mystrongname.snk mystrongnamepublic.txt

sn -tp mystrongnamepublic.snk > mystrongnamepublic.txt

the contents of mystrongnamepublic.txt is thus


Microsoft (R) .NET Framework Strong Name Utility Version 4.0.30319.1
Copyright (c) Microsoft Corporation. All rights reserved.

Public key is
0024000004800000940000000602000000240000525341310004000001000100816740d2ecda21
4ef0568d2a000642792de393b2d94e5380dbbaea167ab0672352838a51b28b3dffe148d500201b
bf7e134d422849bec7f658906a82934cdc6954253ba406696623a52d16552c9efad560566e4bd3
489ed85ef0f824fa66130b2c348aaf04d4626b4161bff82074d4ec353a4c27509f6947351817f3
85c4fb9e

Public key token is e4292199104c45ec

next I took the 5 public key string lines and made it into 1 string

start the clearscript c# project

go to properties, signing

check Sign the assembly

click the drop down, select browse, select mystrongname.snk

save the project

in explorer goto the Clearscript\Properties folder.

open AssemblyInfo.tt in notepad.

change all InternalsVisibleTo lines by pasting in ,PublicKey= and your key string.
[assembly: InternalsVisibleTo("ClearScriptV8-32,PublicKey=0024000004800000940000000602000000240000525341310004000001000100b3dd479cfbede9face9ce4e1d294cb3b234c9ae9d912301bb44f3089289cc42b13f3e67f7dfd99be9eb716cb4db5b4ebc9bed2047ddca8d53b81cda35edc67b2c79f51107a516d32b7dbd02dba767a1574c36e1deb9b63adec681f7bdb74f46344933e75198df2b0df8d4a589700fb2b9bfb8162a3613dd5c43c5dc88a56cda0")]

do the same to AssemblyInfo.cs

ONTO THE ClearscriptV8 C++ DLL!!!

I am just going to example the 32 project but do it to the 64 the same way.

copy mystrongname.snk into clearscript\v8\clearscriptv8\32 folder

start the project

access the property page

select configuration properties\linker\advanced

select the dropdown for key file, browse and select mystrongname.snk

compile the c++ project

open the c# project and compile.

VOILA!!! pure happiness once again.

Sir Clearscript I now understand where my assembly location problems arised. VS has a habit of copying assemblies a project exe references to the project's bin directory instead of leaving them where they were. Once I had all the support dlls in that same directory all was gold. When I added a reference to clearscript.dll in my dll it ran fine as long as all the support dlls were in the directory clearscript.dll was in. So that is good, exactly as expected and needed.
Coordinator
Jul 27, 2013 at 5:47 PM
Edited Jul 27, 2013 at 6:11 PM
When I installed 2012 express there was a message that said it was for evaluation only and there was a prompt if it was going to be used for commercial purposes. 2010 express did not have any of those chillers in it's license.

Visual Studio 2012 Express can be evaluated for up to 30 days, but you can get a free perpetual license by registering it. See the download page.

As for commercial development, the Visual Studio 2012 and MSDN Licensing Whitepaper contains the following (with our emphasis):

Visual Studio Express 2012 Products
A number of free development tools are also available, including Visual Studio Express 2012 for Windows 8, Visual Studio Express 2012 for Web, Visual Studio Express 2012 for Windows Desktop, and Visual Studio Express 2012 for Windows Phone 8. These tools provide a subset of the functionality available in Visual Studio Professional 2012 and are specific to writing applications targeting these platforms. Each of these Visual Studio Express 2012 products is licensed per user and subject to the use terms included with the product. Visual Studio Express can be used to build production applications.

Also check out the product-specific EULA that's displayed at installation time.

By the way, we're glad you found solutions to the issues you were having, and we'd like to thank you very much for sharing the details!