Multiple Versions of Dyalog on Same Machine?

Using (or providing) components based on the "Win32" framework

Multiple Versions of Dyalog on Same Machine?

Postby arcfide on Tue Jun 25, 2013 12:17 am

I'm writing some code that should work with either the 64-bit or 32-bit version of Dyalog, but they have different code paths. I would like to be able to test these environments. While it seems like I can run both versions of Dyalog APL from the same machine okay, I am getting some problems when I try to change the default version that runs. I can manually select a dialog executable to use that is differently named then the default dyalog.exe, but if I select a different dyalog.exe (say, from C:\Program Files instead of from C:\Program Files (x86)) then it still uses the default dialog.exe program. Is there a way to control which Dyalog is the default Dyalog used on Windows? Are multiple (64-bit and 32-bit) versions supported at the same time on the same machine?

Finally, some of this problem would be fixed if I could somehow get control over the working directory that is used when I load the files. If I load a workspace, I cannot seem to get any control over what the working directory is, and this seems to affect the searching for DLLs. Right now I have the workspace in the same location as the DLLs for ease of distribution. The intention is that the user can just load that workspace and go. However, I have found that just starting Dyalog and loading the workspace does not work. The only thing that does work (that is, ensure that the search paths find the DLLs) is if I explicitly double-click on the workspace, in which case the working directory seems to be set to the correct folder. Otherwise, I seem to have no control over the working directory. I'm a complete N00b when it comes to handling working directories and the Windows version of Dyalog, so any help in explaining these issues of loading and launching would be much appreciated.
arcfide
 
Posts: 19
Joined: Fri Dec 09, 2011 3:53 am

Re: Multiple Versions of Dyalog on Same Machine?

Postby Vince|Dyalog on Tue Jun 25, 2013 1:51 pm

Hi arcfide,

Yes, you can have multiple versions on the same machine, and 64-bit and 32-bit versions can co-exist fine. You can also have Dyalog Classic and Unicode on the same computer as well.

How to control which dyalog opens when you double click on a .dws file:

viewtopic.php?f=22&t=18


You can set the current directory in the shortcut that starts Dyalog by editing the “Start in” field.

You can also set it under program control by using the SetCurrentDirectory function from the supplied files workspace:

)load files
C:\Program Files (x86)\Dyalog\Dyalog APL 13.2 Unicode\ws\files saved Wed Jan 30 18:14:48 2013
Files.SetCurrentDirectory 'c:\tmp\'
Files.GetCurrentDirectory
c:\tmp

Regards,

Vince
Vince|Dyalog
 
Posts: 412
Joined: Wed Oct 01, 2008 9:39 am

Re: Multiple Versions of Dyalog on Same Machine?

Postby Vince|Dyalog on Tue Jun 25, 2013 2:09 pm

If you're interested in learning more about how DLLs are loaded, search the internet for "LoadLibrary MSDN".

Regards,

Vince
Vince|Dyalog
 
Posts: 412
Joined: Wed Oct 01, 2008 9:39 am

Re: Multiple Versions of Dyalog on Same Machine?

Postby arcfide on Tue Jun 25, 2013 6:32 pm

Hey Vince, Thanks a bunch for the tips. I was wondering, is there also a similar way to set the working directory specifically to the location of the workspace without necessarily knowing where that is? Is the files workspace documented anywhere?
arcfide
 
Posts: 19
Joined: Fri Dec 09, 2011 3:53 am

Re: Multiple Versions of Dyalog on Same Machine?

Postby Vince|Dyalog on Wed Jun 26, 2013 8:51 am

Have a look at the what you get from each of these and see if you can parse them to get the directory where the workspace is.
      cmdlineargs←2 ⎕nq '.'   'getcommandlineargs'  'Dyalog'
cmdline←2 ⎕nq '.' 'getcommandline'
⎕wsid


Then, you could use the Files.SetCurrentDirectory to set the current directory to that location.

Please note that the MSDN documentation for LoadLibrary does not recommend using SetCurrentDirectory where DLL loading is concerned. It recommends the following for DLL loading:
The search path can be altered using the SetDllDirectory function. This solution is recommended instead of using SetCurrentDirectory or hard-coding the full path to the DLL.
There is even more detail in MSDN under the heading "Dynamic-Link Library Search Order"

In our Documentation centre(http://docs.dyalog.com/), we have a manual named "Guide to the Code Libraries"

It has one page which describes the Files workspace:

Files workspace

Handling files and directories

USE This workspace provides cover functions for common operations in the file system, encapsulating both native file-system primitives such as ⎕NTIE and Windows API calls.

See the source for function syntax.
      AppendText      Appends single-byte text to a named file
Copy Copy one file to another; protected mode optional
Delete Delete a named file
Dir Directory information for a filepath
DirX Extended directory information for a filepath
Exists Boolean result indicates whether file exists
GetCurrentDirectory Get current directory
ReadAllLines Read a text file as single-byte text; return lines as nested character vector
ReadAllText Read a text file as single-byte text
MkDir Make a directory
Move Named file to another location
PutText Write single-byte text to a file, accepting scalar, vector, matrix or nested character arrays
RmDir Remove a directory
SetCurrentDirectory Set current directory


Regards,

Vince
Vince|Dyalog
 
Posts: 412
Joined: Wed Oct 01, 2008 9:39 am


Return to Windows: GUI, COM/OLE/ActiveX

Who is online

Users browsing this forum: No registered users and 1 guest