Creating, using an external Function.

andrej
6 days ago
22 hours ago
  • andrej - 6 days ago

    Hello all,
    I would like to create a simple which runs directly on Control WinV3 x64 3.5.21.0

    For this purpose I created a simple dll myAdder.dll in Cpp

    // MyAdder.cpp
    // cl /LD /EHsc MyAdder.cpp /Fe:MyAdder.dll
    #include <windows.h>
    extern "C" __declspec(dllexport) int __cdecl CmpMyAdder_Add(int a, int b)
    {
        return a + b;
    }
    

    I added the dll in the respective folder. Furthermore I "registred" the dll in the CODESYSControl.cfg. However, when I want to use the library I get the error message: Uresolved reference: *'CMPMYADDERADD' *

    Can you give me a hint what step I missed or where I need to declare the dll, such that the dll resp. the reference can be resolved.

    Many thanks and kind regards

     

    Last edit: andrej 6 days ago
  • eschwellinger

    eschwellinger - 5 days ago

    you need the check the plclog if the the component have been loaded on startup of th plc.

     

    Last edit: eschwellinger 5 days ago
  • andrej - 22 hours ago

    Hello,
    many thanks for your reply. I checked the logs. It seems that dll is not loaded. However other dll such as the Webserver are loaded. Could you tell me what I need to do such that my dll is loaded.
    (Furthermore I changed the C-Function a bit. I used the M4.exe from the SDK.)

    Many thanks.

     

    Last edit: andrej 22 hours ago

Log in to post a comment.