Hi David,
I've been testing PolyML 5.1 on windows and was wondering how I should go about creating a console PolyML application.
I've built polyml using Visual Studio 2005 and the Visual Studio 6 workspace. This worked with hardly any problems. Visual studio 2005 converted the .dsp to a solution without any warnings. Building the solution failed however, as two of the custom build commands needed the $(InputPath) variables double-quoting to protect spaces in the filenames. After this the build succeeded and I was able to export a simple function (fib.obj) and link it using:
link /OUT:fib.exe /SUBSYSTEM:WINDOWS fib.obj PolyLib.lib PolyMainLib.lib libcmtd.lib
This produces a windows executable using your console GUI (using WinMain as entry point which calls PolyWinMain).
What I would really like is an executable or DLL I can use from another application. I don't have much experience with windows programming and in particular DDE which you use for the console GUI so I realise I may be asking a silly question. I would be happy with a simple console application with interaction through stdin, stdout and stderr, so my question is - what's the best way of building such an application?
Am I right in thinking that the main runtime is entered through polymain() in PolyLib? Could this be exported along with PolyWinMain from PolyLib.dll and a main() stub be provided in PolyMain.lib. (I've noticed that if you call WinMain with a null pointer for the hInstance parameter you get an (apparently working) console application but this is surely a bad idea and unnecessary! ;-))
regards, Richard.
Richard,
Richard Harrison wrote:
What I would really like is an executable or DLL I can use from another application. I don't have much experience with windows programming and in particular DDE which you use for the console GUI so I realise I may be asking a silly question. I would be happy with a simple console application with interaction through stdin, stdout and stderr, so my question is - what's the best way of building such an application?
The native Windows version puts up its own console GUI if stdin and stdout are not present. So the simplest way to use your application from another is to use CreateProcess and pass handles to your standard input and standard output through the StartupInfo structure. You can then communicate through the input and output streams. DDE is only used where in Unix signals would be used: i.e. to interrupt or kill the application, so you don't have to use it.
If you want something running in a console you may find it simpler to use Cygwin which provides a more Unix-like interface and in particular, signals.
Regards, David