Returning string data from c++ dll does not work

Discussion in 'Tally Developer' started by bytelogik, Jun 21, 2023.

    
  1. bytelogik

    bytelogik New Member


    TDL:

    [Field: Test Fld]
    Use : Name Field
    Set as : "Hello"+ @SomeString
    Set Always : Yes
    Read Only : Yes
    SomeString:$$CallDllFunction: Project3:HelloWorld3

    --------------------

    C++

    #include <windows.h>
    #include <iostream>
    #include <string>
    using namespace std;
    #include <OleAuto.h>

    //does not work
    extern "C" __declspec(dllexport) wchar_t* __stdcall HelloWorld3()
    {
    wchar_t* c = (wchar_t*) "Hello World";
    return SysAllocString(c);
    }

    //does not work
    extern "C" __declspec(dllexport) const char* __stdcall HelloWorld4() {
    return "Hello World";
    }

    What data type syntax to use so that the returned string is displayed in TDL field ??

    Thanks in advance..
     


  2. bytelogik

    bytelogik New Member


    has anyone got workaround for sending and retrieving string data from a standard C++ dll ?
     


Share This Page