Search code examples
c#dllokuma

Okuma THINC API Dependency File Not Found Exception


I have to convert a very very simple program from Vb to C#. The Vb has those references enter image description here

From seeing here if I am not mistaken those should be managed dlls. I achieve the same result if I follow the procedure here with the dumpbin.exe program.

So everything should be fine. But when I do that CWorkpiece instance = new CWorkpiece(); I get the following error

enter image description here

which tells that the relevant dll is not in the right place. However the file is right were it should be enter image description here

That said I have thought that perhaps I had done a wrong investigation but adding the following lines didn't help

    [DllImport("C:\\Temp\\1\\Okuma.CLDATAPI.dll")]
    public static extern int CWorkpiece();

So in short the problem is all related with that dll which can't be found Thank you in advance for any help Patrick


Solution

  • Refer to Section "4.5.1.3.3.1 Missing library file" of the THINC API Installation Manual.

    Ex Message

    All applications developed with .NET THINC-API libraries are required to include an exact version of THINC-API libraries with the custom installation. THINC-API libraries compiled with application should be installed with your application folder.

    The above error message shows that THINC-API library named Okuma.CLDATAPI.dll cannot be found at the folder where the application runs from.

    Solution: Include THINC-API libraries compiled in your application with your custom setup and re-install your application with new setup.

    Yes the THINC API libraries are managed .NET libraries. The command (CMD) API is written in VB, and the data API in VC++. Depending on the API version you have, these libraries either written in .NET 1.1 or 4.0. So you really shouldn't be attempting to Pinvoke them.

    The real problem you are facing is attempting to run your program in an environment which does not have the THINC API installed. Yes, you have the libraries referenced by your application, but that is not enough.

    The THINC API libraries have several dependencies including:

    • Okuma.FlexNet.dll
    • Okuma.ApiLog.dll / Okuma.Api.LogService.dll
    • LDATAPI.dll / MDATAPI.dll / GDATAPI.dll
    • LCMDAPI.exe / MCMDAPI.exe / GCMDAPI.exe
    • PIODlib.dll
    • Softswitch.exe

    Solution

    1. Obtain a copy of the API Install disc; either from a disc that has shipped with an Okuma machine, or a new version through your Okuma dealer.

    2. Install the development version of the THINC API in your development environment.

    Note that you will not be able to Init() or call any other API functions unless your environment is one of the following:

    • An actual Okuma Machine with CAPI Option and THINC API Installed
    • An "NC-Master" Simulator such as this: P300A NC-Master Simulator
    • Or a PC NC-Master which is an all software simulator.