I put the code back up (https://github.com/ihnorton/COMCall.jl). The interface query examples might help to get started, though I'm not sure if they work with Julia 0.4.
On Thu, Feb 18, 2016 at 9:04 PM, Isaiah Norton <isaiah.nor...@gmail.com> wrote: > Is there any easy (or failing that, hard) way to do this? > > > COM aside, the first issue is that this syntax isn't quite right: > > >> ccall( ("SimpleLibrary.MyClass.MySum", "SimplyLibrary"), Float32, (1.2, >> 3.1)) > > > There are a couple things to change here: > - need argument types, as a tuple, after the return type. > - `double` is equivalent to Float64 on all platforms, rather than Float32. > (for convenience, there is a `Cdouble` alias) > - argument values (or variables) need to be passed individually. > > So it should look like: > > ccall( ("SimpleLibrary.MyClass.MySum", "SimplyLibrary"), Cdouble, > (Cdouble, Cdouble), 1.2, 3.1) > > The bigger issue here is going to be finding the function. > "SimpleLibrary.MyClass.MySum" is probably not going to work (a C symbol > won't look like that). Unless the DLL explicitly exports a C symbol, you > will probably need to query the COM registry, then the interface, and build > an appropriate dispatch table. See this article for a discussion of how to > do it from C, which could be replicated in pure Julia: > http://www.codeproject.com/Articles/13601/COM-in-plain-C > > (if you only need a few functions from a given interface, that should be > straightforward, but a generic interface is a bit involved) > > On Thu, Feb 18, 2016 at 6:32 PM, Alex Mellnik <a.r.mell...@gmail.com> > wrote: > >> Sorry to reopen an old thread. I'm trying to do something similar and >> haven't been able to figure it out so far. Isaiah, I noticed that your >> COMCall.jl library is not on GitHub anymore. Is this code still floating >> around anywhere or is there a different suggested route? >> >> In my case, I have a dll (written in c# I think) which is currently being >> called from Python using win32com >> <http://docs.activestate.com/activepython/3.3/pywin32/html/com/win32com/HTML/QuickStartClientCom.html>. >> I would like to call the dll directly from Julia without going through >> PyCall (although this works). I don't have the source for that dll but a >> simple example is: >> >> using System; >> using System.Collections.Generic; >> using System.Linq; >> using System.Text; >> using System.Threading.Tasks; >> >> namespace SimpleLibrary >> { >> public class MyClass >> { >> public static double MySum(double a, double b) >> { >> return a + b; >> } >> >> public static double NoArgs() >> { >> return 1.4; >> } >> >> } >> } >> >> Naively trying to call these with ccal like >> >> ccall( ("SimpleLibrary.MyClass.MySum", "SimplyLibrary"), Float32, (1.2, >> 3.1)) >> >> gives a "wrong number of arguments" error. Is there any easy (or failing >> that, hard) way to do this? >> > >