Hi,

Some assemblies are loaded by default an can be used directly. But
like IronPython, you will need to *explicitly* load most assemblies to
be imported into your program. This differs from C# which does it
"under the hood". The Assemblies can be loaded from the GAC or from a
dll if it is not loaded/referenced by default. For example, as
System.Console is loaded by default you can directly use:

(System.Console/WriteLine "Clo[sjz]ure")

However, the System.Windows.Forms assembly is not loaded by default.
So you would need:

(System.Reflection.Assembly/LoadWithPartialName
"System.Windows.Forms")

or

(System.Reflection.Assembly/Load "System.Windows.Forms,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")


You can then import the MessageBox class

(import '(System.Windows.Forms MessageBox))
(MessageBox/Show "Clo[sjz]ure")

Regards,

Iwan

On Feb 24, 12:26 am, adam11235 <adam.k.web...@gmail.com> wrote:
> Hi,
>
> I'm unsure of how to get clojure-clr to reference assemblies that a
> program needs.
>
> I can successfully get this to show a message box via the REPL:
>
> (System.Windows.Forms.MessageBox/Show "hello world")
>
> I can successfully save this to a file, add the file as a command-line
> arg inside VisualStudio and run the Clojure.Main project which takes
> the cmd line arg, correctly loads and executes the code
>
> However if I save that to a file and then try the following (from the
> command line, outside of VS, I get an exception:
>
> pathTo\Clojure\Clojure.Main\bin\debug\Clojure.Main.Exe c:\clj
> \helloworld.clj
>
> I have also changed the contents of the file to the following, still
> with no success:
>
> 1)
> (import '(System.Windows.Forms MessageBox ))
> (MessageBox/Show "hello world")
>
> 2)
> (import '(System.Windows.Forms MessageBox ))
> (System.Windows.Forms.MessageBox/Show "hello world")
>
> Any hints?
>
> Thanks, Adam.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to