Interfacing with a C dll on Windows

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Interfacing with a C dll on Windows

Sean P. DeNigris
Administrator
I'm working with an SDK that works like this:
- A running application let's you supply your own C DLL, which imports a proprietary one
- During the course of the application running, various events will cause pre-defined hooks to be called in the custom dll

So, as always, I'm /mostly/ unwilling to code in C (unless it's inside a Smalltalk VM, ha ha). I want to do most of the processing in Pharo. And, I haven't done anything on Windows in years. How (if possible) do I directly integrate the custom dll, running inside their app, with a Squeak VM? I'd love to just use the dll as glue to communicate between the application and my image...

Thanks,
Sean
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Interfacing with a C dll on Windows

David T. Lewis
On Sat, Oct 27, 2012 at 09:22:10AM -0700, Sean P. DeNigris wrote:

> I'm working with an SDK that works like this:
> - A running application let's you supply your own C DLL, which imports a
> proprietary one
> - During the course of the application running, various events will cause
> pre-defined hooks to be called in the custom dll
>
> So, as always, I'm /mostly/ unwilling to code in C (unless it's inside a
> Smalltalk VM, ha ha). I want to do most of the processing in Pharo. And, I
> haven't done anything on Windows in years. How (if possible) do I directly
> integrate the custom dll, running inside their app, with a Squeak VM? I'd
> love to just use the dll as glue to communicate between the application and
> my image...

I do not understand the question. Are you referring to some actual commercial
or proprietary application that you want to have interacting with your
image? Or is the "application" something that you are doing in Pharo?
Is the SDK something that exists and that you are trying to use, or are
you trying to create an SDK that someone else would be able to use?

If you are just trying to call functions in a DLL from an application
in Pharo, then you will probably want to use FFI for this.

Dave

_______________________________________________
VM-beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/vm-beginners
Reply | Threaded
Open this post in threaded view
|

Re: Interfacing with a C dll on Windows

Sean P. DeNigris
Administrator
David T. Lewis wrote
Are you referring to some actual commercial... proprietary application that you want to have interacting with your image?
Yes

David T. Lewis wrote
Is the SDK something that exists and that you are trying to use
Yes. Specifically it's the SDK for the TradeStation trading platform (https://developer.tradestation.com/documents/EasyLanguage_Extension_SDK.pdf)

I was hoping for a way to use my custom dll as a magical link between the running platform and my image, without having to resort to IPC...
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Interfacing with a C dll on Windows

David T. Lewis
On Sat, Oct 27, 2012 at 09:51:52PM -0700, Sean P. DeNigris wrote:

> David T. Lewis wrote
> > Are you referring to some actual commercial... proprietary application
> > that you want to have interacting with your image?
>
> Yes
>
>
> David T. Lewis wrote
> > Is the SDK something that exists and that you are trying to use
>
> Yes. Specifically it's the SDK for the TradeStation trading platform
> (https://developer.tradestation.com/documents/EasyLanguage_Extension_SDK.pdf)
>
> I was hoping for a way to use my custom dll as a magical link between the
> running platform and my image, without having to resort to IPC...

Is this the scenario?

 - You want to write your own application in Squeak/Pharo
 - Your application will make API calls to TradeStation EasyLanguage
   procedures in order to obtain information or perform functions
 - TradeStation will provide event notification, and your DLL will
   accept these events and turn them into something that your application
   understands (e.g. signal a semaphore for a waiting process in Squeak).

If this is more or less the architecture you have in mind, then I'd
say that it could in principle be done with a plugin or maybe FFI,
but this would be a complex thing to implement and I am quite sure
that you would not want to undertake it without a good working
knowledge of C and Windows programming.

In addition, I would guess that TradeStation is a runtime environment
unto itself, and that if you link a Squeak VM directly to that environment
you are likely to run into conflicts between them. I can't say specifically
what the problems would be, but basically you would be trying to take
two software enviroments that both expect to "own" the environments
that they live in, and conflicts (usually undocumented) are likely
to arise.

Having said that, it looks to me like getting the two environments
(Squeak and TradeStation) to communicate bidirectionally would be a
natural fit for a higher level IPC scheme such as SOAP or a custom
socket based protocol. This kind of architecture is likely to be more
robust in terms of maintainability and ease of debugging, and it will
provide some degree of future-proofing for your application as changes
occur in Squeak VM, TradeStation, and Windows.

I see references to COM in the document link you gave, so I suspect
that some kind of interface like this may be available. So my advice
is to find some higher level IPC, SOAP, XML or whatever that may be
supported by TradeStation, and then look for a way to talk to that
from Squeak/Pharo.

Dave

_______________________________________________
VM-beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/vm-beginners