Fiel's problem was a little simpler -- his dllimport method was out in
C# class that was imported.  The problem appears to be that reflection
is not finding the method. That is likely either a signature-matching
problem (declared args vs supplied params) or even just having the
flags set a little wrong on the Type.GetMethods in the reflection code
so that the dllimport method is excluded.  Should be an easy fix.

Doing it all in Clojure as you suggest -- I'll work on it.  Actually,
the de Icaza blog entry is priceless.  It has actual DLR code that can
be, er, um, mined for ideas.  Thanks for the link.

-David


On Dec 2, 9:59 am, Timothy Baldridge <tbaldri...@gmail.com> wrote:
> > If you could give me a small example of how you would like to use
> > this, I can take a look.
>
> I suggest you read  Miguel de Icaza's blog entry here about using
> dynamic and pinvoke. The concept is quite simple. Basically you have
> to generate a method on-the-fly and tag it with the correct
> attributes, then simply use that method to call the pinvoke routines.
>
> http://tirania.org/blog/archive/2009/Aug-11.html
>
> The one thing to note though, is the above blog uses the
> CallingConventions enum value for Linux. Windows has standardized on a
> different calling convention, so you may have to dynamically switch to
> the correct enum value depending on the platform.
>
> From there it should be possible to setup something like this (Pinvoke
> info taken fromhttp://pinvoke.net/default.aspx/user32.MessageBox):
>
> (defdllimport user32 "user32.dll" :char-set-auto)
>
> (def message-box (extern user32 ^Integer MessageBox [^Integer hWind
> ^String text ^String caption ^Integer options]))
>
> Anyway, just some ideas.
>
> Timothy

-- 
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