Why does ⎕NA fail with a "FILE ERROR 2"?

The Dyalog "Knowledgebase". This forum is read-only
Forum rules
The FAQ is a read-only forum which is in general updated only by employees of Dyalog Ltd. It replaces the FAQ page which existed under http://www.dyalog.com. Rather than rejecting other posts to this forum, such posts will be put in a moderation queue, and moved to a more appropriate forum.

Why does ⎕NA fail with a "FILE ERROR 2"?

Postby Vince|Dyalog on Fri Aug 20, 2010 9:40 am

A "FILE ERROR 2 The system cannot find the file specified" for ⎕NA usually means that the DLL cannot be loaded. We use the Windows API LoadLibrary call to load DLLs.

There are two possible reasons why LoadLibrary cannot load your DLL.

The first possibility to explore is that the DLL is not in the same directory as the executable or in a directory on the system path.

First, find the location of the DLL. Now, you can choose one or more of the following three methods to correct this issue.
    A) Change the ⎕NA call so it also specifies the full path name.
    B) You can add the location of the DLL to be part of the system path. You can use the following APL code to find out what your system path is currently:
    Code: Select all
    'GetEnvironmentVariable'⎕NA'u kernel32|GetEnvironmentVariable* <0T >0T U'
     GetEnvironmentVariable'PATH' 4096 4096

    C) Copy the DLL to be in the same directory that your executable is in.

If you have completed step 1 and the DLL still does not load, your operating system is missing DLLs that the DLL requires. To find out which DLLs are missing, use the Dependency Walker on it. You can download Dependency Walker from http://www.dependencywalker.com.
Vince|Dyalog
 
Posts: 348
Joined: Wed Oct 01, 2008 9:39 am

Return to Frequently Asked Questions (FAQ)

Who is online

Users browsing this forum: No registered users and 1 guest