Announcement

Collapse
No announcement yet.

Miva Function Extension - Need MvBinary.zip

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Miva Function Extension - Need MvBinary.zip

    Hello,

    We have 2 needs related to adding new functions to the miva language using Miva API (not miva merchant). I think the file mvbinary.zip that Jim Harrell made available a decade or so ago would give us the guidance we need. Does anyone have this file? Markus had last posted it over a decade ago under the subject api kit mvcommerce example. If anyone has this available, can you please make it available.

    Thanks - mike

    #2
    Don't know where that file is but this should get you going...

    Code:
    #include <stdlib.h>
    #include "mivapi.h"
    
    MV_EL_FunctionParameter customfunction_params[] =
    {
    "param1", 5, EPF_NORMAL,
    "param2", 5, EPF_NORMAL
    };
    
    void bi_customfunction( mvProgram prog, mvVariableHash parameters, mvVariable returnvalue, void **data )
    {
    int param1_length, param2_length;
    const char *param1, *param2;
    
    param1 = mvVariable_Value( mvVariableHash_Index( parameters, 0 ), &param1_length );
    param2 = mvVariable_Value( mvVariableHash_Index( parameters, 0 ), &param2_length );
    
    // do something with your parameters here
    
    mvVariable_SetValue_Integer( returnvalue, 1 );
    }
    
    MV_EL_Function_List *miva_function_table()
    {
    static MV_EL_Function exported_functions[] =
    {
    { "customfunction", 14, 2, customfunction_params, bi_customfunction },
    { 0, 0, 0, 0, 0 }
    };
    
    static MV_EL_Function_List list = { MV_EL_FUNCTION_VERSION, exported_functions };
    
    return &list;
    }
    and compile with something such as

    Code:
    gcc -fpic -bundle -undefined suppress -flat_namespace -I/usr/local/mivavm/include -o customfunctions.so customfunction.c
    David Carver
    Miva, Inc. | Software Developer

    Comment


      #3
      Excellent! Thank you very much for the quick reply and assistance.

      Greatly appreciated!

      -mike

      Comment


        #4
        David,

        Thanks again for code snippet! It was helpful. When we do a dump of our dll, we see the appropriate export functions:

        DUMPBIN OF OUR DLL
        ordinal hint RVA name
        1 0 00001294 bi_uspsbarcode
        2 1 00001181 miva_function_table
        3 2 000013A2 miva_register_library

        The problem is that when we try to compile our test script, we are getting a compiler error:
        mvc1: Unable to register .DLL/.so 'C:\MSC\BUILTINS\Dll3.dll': Unknown error 193

        Update: On another workstation I am getting this error when compiling:
        mvc1: Unable to register .DLL/.so 'C:\MSC\BUILTINS\Dll3.dll': The specified module could not be found

        Any ideas?

        Thanks,
        -mike
        Last edited by MLT; 04-14-21, 04:41 PM.

        Comment

        Working...
        X