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