Jump to content

Plugin Question


Recommended Posts

I am trying to work on a few AutoIt plugins. I am a bit confused with the example.c file that came with the Plugin_SDK.

BTW Thanks to everyone who had a hand in the Plugin architecture.

The problem I am not understanding is the fact that AU3_SetString(pMyResult, "Hello World"); Sets the result?

I have never created a .dll file so this is all really new to me. Not to mention my C++ skills arent the greatest. I am just trying to learn.

Anyone that can offer some assistance, it would be greatly appreciated.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Okay I think I have figured out my above question, but now when I compile I am getting the following error.

Compiler: Default compiler

Building Makefile: "C:\Documents and Settings\Jarvis\My Documents\C++\AutoIt\Plugins\File-String Hash\Makefile.win"

Executing make...

make.exe -f "C:\Documents and Settings\Jarvis\My Documents\C++\AutoIt\Plugins\File-String Hash\Makefile.win" all

g++.exe -c ../Plugin_SDK/src/au3plugin.c -o ../Plugin_SDK/src/au3plugin.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include"

../Plugin_SDK/src/au3plugin.c: In function `AU3_PLUGIN_VAR* AU3_AllocVar()':

../Plugin_SDK/src/au3plugin.c:30: error: invalid conversion from `void*' to `AU3_PLUGIN_VAR*'

../Plugin_SDK/src/au3plugin.c: In function `void AU3_SetString(AU3_PLUGIN_VAR*, const char*)':

../Plugin_SDK/src/au3plugin.c:89: error: invalid conversion from `void*' to `char*'

../Plugin_SDK/src/au3plugin.c: In function `char* AU3_GetString(const AU3_PLUGIN_VAR*)':

../Plugin_SDK/src/au3plugin.c:105: error: invalid conversion from `void*' to `char*'

../Plugin_SDK/src/au3plugin.c:133: error: invalid conversion from `void*' to `char*'

make.exe: *** [../Plugin_SDK/src/au3plugin.o]Error 1

Execution terminated

Below is the my code and then the code of the file in question.

/*
 * Plugin for AutoItv3
 * FileHash() and StringHash()
 * Currenly MD5 is the only hash option.
 * MD5 functions by Jarvis Stubblefield (jjs at vortexrevolutions dot com)
 * Plugin_SDK and AutoItv3 Jon Bennett and his team of Developers
 *
 * dllHash.cpp
 */

#include <stdio.h>
#include <windows.h>

#include "au3plugin.h"
#include "JSmd5.h"


/****************************************************************************
 * Function List
 *
 * This is where you define the functions available to AutoIt.  Including
 * the function name (Must be the same case as your exported DLL name), the
 * minimum and maximum number of parameters that the function takes.
 *
 ****************************************************************************/

/* "FunctionName", min_params, max_params */
AU3_PLUGIN_FUNC g_AU3_Funcs[2] = 
{
    {"FileHash", 1, 2},
    {"StringHash", 1, 2}
};


/*
Multiple Function Example

AU3_PLUGIN_FUNC g_AU3_Funcs[NUMFUNCS] = 
{
    {"PluginFunc1", 2, 2},
    {"PluginFunc2", 1, 1},
    {"PluginFunc3", 1, 5}
};
*/


/****************************************************************************
 * AU3_GetPluginDetails()
 *
 * This function is called by AutoIt when the plugin dll is first loaded to
 * query the plugin about what functions it supports.  DO NOT MODIFY.
 *
 ****************************************************************************/

AU3_PLUGINAPI int AU3_GetPluginDetails(int *n_AU3_NumFuncs, AU3_PLUGIN_FUNC **p_AU3_Func)
{
    /* Pass back the number of functions that this DLL supports */
    *n_AU3_NumFuncs = sizeof(g_AU3_Funcs)/sizeof(AU3_PLUGIN_FUNC);;

    /* Pack back the address of the global function table */
    *p_AU3_Func = g_AU3_Funcs;

    return AU3_PLUGIN_OK;
}


/****************************************************************************
 * DllMain()
 *
 * This function is called when the DLL is loaded and unloaded.  Do not 
 * modify it unless you understand what it does...
 *
 ****************************************************************************/

BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
{
    switch (ul_reason_for_call)
    {
        case DLL_PROCESS_ATTACH:
        case DLL_THREAD_ATTACH:
        case DLL_THREAD_DETACH:
        case DLL_PROCESS_DETACH:
            break;
    }
    return TRUE;
}

/****************************************************************************
 * FileHash()
 *
 * This function should return a hash of the chosen file, it accepts 2
 * parameters:
 * 
 * FileHash("filename.exe", 1)
 * 
 * 1st Parameter = The file you wish to return a hash value of.
 * 2nd Parameter = Type of hash to be done. Currently only MD5.
 *
 ****************************************************************************/

AU3 PLUGIN DEFINE(FileHash)
{
    /* The inputs to a plugin function are:
     *      n_AU3_NumParams     - The number of parameters being passed
     *      p_AU3_Params        - An array of variant like variables used by AutoIt
     *
     * The outputs of a plugin function are:
     *      p_AU3_Result        - A pointer to a variant variable for the result
     *      n_AU3_ErrorCode     - The value for @Error
     *      n_AU3_ExtCode       - The value for @Extended
     */

    AU3_PLUGIN_VAR  *p_HashResult;
    char            *s_FileName, *s_MD5Hash;
    int           i_Hash;

    /* Get string representations of the two parameters passed - this works even if we
     * were passed numbers or floats.
     * Note: AU3_GetString() allocates some memory that we must manually free later.
     */
     
    s_FileName  = AU3_GetString(&p_AU3_Params[0]);
    i_Hash      = AU3_GetInt32(&p_AU3_Params[1]);

    s_MD5Hash = FileMD5Encrypt(s_Filename);

    /* Free temporary storage */
    AU3_FreeString(s_FileName);
    
    /* Allocate and build the return variable */
    p_HashResult = AU3_AllocVar();

    /* Set the return variable */
    //AU3_SetString(pMyResult, "Hello World");
    AU3_SetString(p_HashResult, s_MD5Hash)
    /*AU3_SetInt32(pMyResult, 42);*/
    

    /* Pass back the result, error code and extended code.
     * Note: AutoIt is responsible for freeing the memory used in p_AU3_Result
     */
    *p_AU3_Result       = p_HashResult;
    *n_AU3_ErrorCode    = 0;
    *n_AU3_ExtCode      = 0;

    return AU3_PLUGIN_OK;
}

AU3 PLUGIN DEFINE(StringHash)
{
    /* The inputs to a plugin function are:
     *      n_AU3_NumParams     - The number of parameters being passed
     *      p_AU3_Params        - An array of variant like variables used by AutoIt
     *
     * The outputs of a plugin function are:
     *      p_AU3_Result        - A pointer to a variant variable for the result
     *      n_AU3_ErrorCode     - The value for @Error
     *      n_AU3_ExtCode       - The value for @Extended
     */

    AU3_PLUGIN_VAR  *p_HashResult;
    char            *s_String, *s_MD5Hash;
    int           i_Hash;

    /* Get string representations of the two parameters passed - this works even if we
     * were passed numbers or floats.
     * Note: AU3_GetString() allocates some memory that we must manually free later.
     */
     
    s_String    = AU3_GetString(&p_AU3_Params[0]);
    i_Hash      = AU3_GetInt32(&p_AU3_Params[1]);

    s_MD5Hash = StringMD5Encrypt(s_String);

    /* Free temporary storage */
    AU3_FreeString(s_String);
    
    /* Allocate and build the return variable */
    p_HashResult = AU3_AllocVar();

    /* Set the return variable */
    //AU3_SetString(pMyResult, "Hello World");
    AU3_SetString(p_HashResult, s_MD5Hash)
    /*AU3_SetInt32(pMyResult, 42);*/
    

    /* Pass back the result, error code and extended code.
     * Note: AutoIt is responsible for freeing the memory used in p_AU3_Result
     */
    *p_AU3_Result       = p_HashResult;
    *n_AU3_ErrorCode    = 0;
    *n_AU3_ExtCode      = 0;

    return AU3_PLUGIN_OK;
}

Below is the code that is having the trouble with the compilation errors. (au3plugin.c)

/*
 *
 * AutoIt v3 Plugin SDK
 *
 * Copyright (C)1999-2005 Jonathan Bennett <jon at autoitscript dot com>
 *
 * au3plugin.c
 *
 * This code may be freely used to create plugins for use in AutoIt.
 *
 */

#include <stdio.h>
#include <windows.h>
#include "au3plugin.h"

// Disable 64bit warnings on Visual C .NET
#ifdef _MSC_VER
    #pragma warning(disable : 4311 4312)
#endif


/****************************************************************************
 * AU3_AllocVar()
 ****************************************************************************/

AU3_PLUGIN_VAR* AU3_AllocVar(void)
{
    AU3_PLUGIN_VAR *pVar = malloc(sizeof(AU3_PLUGIN_VAR));
    pVar->m_nType   = AU3_PLUGIN_INT32;
    pVar->m_nValue  = 0;

    return pVar;
}


/****************************************************************************
 * AU3_ResetVar()
 ****************************************************************************/

void AU3_ResetVar(AU3_PLUGIN_VAR *pVar)
{
    if (pVar == NULL)
        return;

    if (pVar->m_nType == AU3_PLUGIN_STRING)
        free(pVar->m_szValue);

    pVar->m_nType   = AU3_PLUGIN_INT32;
    pVar->m_nValue  = 0;
}


/****************************************************************************
 * AU3_FreeVar()
 ****************************************************************************/

void AU3_FreeVar(AU3_PLUGIN_VAR *pVar)
{
    if (pVar == NULL)
        return;

    AU3_ResetVar(pVar);

    free(pVar);
}


/****************************************************************************
 * AU3_GetType()
 ****************************************************************************/

int AU3_GetType(AU3_PLUGIN_VAR *pVar)
{
    return pVar->m_nType;
}


/****************************************************************************
 * AU3_SetString()
 ****************************************************************************/

void AU3_SetString(AU3_PLUGIN_VAR *pVar, const char *szString)
{
    AU3_ResetVar(pVar);

    pVar->m_nType = AU3_PLUGIN_STRING;
    pVar->m_szValue = malloc( strlen(szString)+1 );
    strcpy(pVar->m_szValue, szString);
}


/****************************************************************************
 * AU3_GetString()
 ****************************************************************************/

char * AU3_GetString(const AU3_PLUGIN_VAR *pVar)
{
    char    szTemp[32];                     // It is unclear just how many 0000 the sprintf function can add...
    char    *szString;

    if (pVar->m_nType == AU3_PLUGIN_STRING)
    {
        szString = malloc( strlen(pVar->m_szValue)+1 );
        strcpy(szString, pVar->m_szValue);
        return szString;
    }


    switch(pVar->m_nType)
    {
        case AU3_PLUGIN_INT32:
            // Work out the string representation of the number
            itoa(pVar->m_nValue, szTemp, 10);
            break;

        case AU3_PLUGIN_INT64:
            // Work out the string representation of the number
            _i64toa(pVar->m_n64Value, szTemp, 10);
            break;

        case AU3_PLUGIN_DOUBLE:
            // Work out the string representation of the number, don't print trailing zeros
            sprintf(szTemp, "%.15g", pVar->m_fValue);       // Have at least 15 digits after the . for precision (default is 6)
            break;

        case AU3_PLUGIN_HWND:
            sprintf(szTemp, "0x%p", pVar->m_hWnd);
            break;
    }

    szString = malloc( strlen(szTemp)+1 );
    strcpy(szString, szTemp);
    return szString;

}


/****************************************************************************
 * AU3_FreeString()
 ****************************************************************************/

void AU3_FreeString(char *szString)
{
    free(szString);

}

/****************************************************************************
 * AU3_SetInt32()
 ****************************************************************************/

void AU3_SetInt32(AU3_PLUGIN_VAR *pVar, int nValue)
{
    AU3_ResetVar(pVar);

    pVar->m_nType = AU3_PLUGIN_INT32;
    pVar->m_nValue = nValue;
}


/****************************************************************************
 * AU3_GetInt32()
 ****************************************************************************/

int AU3_GetInt32(AU3_PLUGIN_VAR *pVar)
{
    switch (pVar->m_nType)
    {
        case AU3_PLUGIN_INT32:
            return pVar->m_nValue;

        case AU3_PLUGIN_DOUBLE:
            return (int)pVar->m_fValue;

        case AU3_PLUGIN_STRING:
            if ( (pVar->m_szValue[0] == '0') && (pVar->m_szValue[1] == 'x' || pVar->m_szValue[1] == 'X') )
            {
                return AU3_HexToDec(&pVar->m_szValue[2]);   // Assume hex conversion
            }
            else
                return atoi(pVar->m_szValue);

        case AU3_PLUGIN_INT64:
            return (int)pVar->m_n64Value;

        case AU3_PLUGIN_HWND:
            return (int)pVar->m_hWnd;

        default:
            return 0;
    }

}


/****************************************************************************
 * AU3_SetInt64()
 ****************************************************************************/

void AU3_SetInt64(AU3_PLUGIN_VAR *pVar, __int64 n64Value)
{
    AU3_ResetVar(pVar);

    pVar->m_nType = AU3_PLUGIN_INT64;
    pVar->m_n64Value = n64Value;
}


/****************************************************************************
 * AU3_GetInt64()
 ****************************************************************************/

__int64 AU3_GetInt64(AU3_PLUGIN_VAR *pVar)
{
    switch (pVar->m_nType)
    {
        case AU3_PLUGIN_INT32:
            return (__int64)pVar->m_nValue;

        case AU3_PLUGIN_DOUBLE:
            return (__int64)pVar->m_fValue;

        case AU3_PLUGIN_STRING:
            if ( (pVar->m_szValue[0] == '0') && (pVar->m_szValue[1] == 'x' || pVar->m_szValue[1] == 'X') )
            {
                return (__int64)AU3_HexToDec(&pVar->m_szValue[2]);  // Assume hex conversion
            }
            else
                return _atoi64(pVar->m_szValue);

        case AU3_PLUGIN_INT64:
            return pVar->m_n64Value;

        default:
            return 0;
    }

}


/****************************************************************************
 * AU3_SetDouble()
 ****************************************************************************/

void AU3_SetDouble(AU3_PLUGIN_VAR *pVar, double fValue)
{
    AU3_ResetVar(pVar);

    pVar->m_nType = AU3_PLUGIN_DOUBLE;
    pVar->m_fValue = fValue;
}


/****************************************************************************
 * AU3_GetDouble()
 ****************************************************************************/

double AU3_GetDouble(AU3_PLUGIN_VAR *pVar)
{
    switch (pVar->m_nType)
    {
        case AU3_PLUGIN_INT32:
            return (double)pVar->m_nValue;

        case AU3_PLUGIN_DOUBLE:
            return pVar->m_fValue;

        case AU3_PLUGIN_STRING:
            if ( (pVar->m_szValue[0] == '0') && (pVar->m_szValue[1] == 'x' || pVar->m_szValue[1] == 'X') )
            {
                return (double)AU3_HexToDec(&pVar->m_szValue[2]);   // Assume hex conversion
            }
            else
                return atof(pVar->m_szValue);

        case AU3_PLUGIN_INT64:
            return (double)pVar->m_n64Value;

        default:
            return 0;
    }

}


/****************************************************************************
 * AU3_SethWnd()
 ****************************************************************************/

void AU3_SethWnd(AU3_PLUGIN_VAR *pVar, HWND hWnd)
{
    AU3_ResetVar(pVar);

    pVar->m_nType = AU3_PLUGIN_HWND;
    pVar->m_hWnd = hWnd;
}


/****************************************************************************
 * AU3_GethWnd()
 ****************************************************************************/

HWND AU3_GethWnd(AU3_PLUGIN_VAR *pVar)
{
    switch (pVar->m_nType)
    {
        case AU3_PLUGIN_HWND:
            return pVar->m_hWnd;

        case AU3_PLUGIN_INT32:
            return (HWND)pVar->m_nValue;

        case AU3_PLUGIN_STRING:
            if ( (pVar->m_szValue[0] == '0') && (pVar->m_szValue[1] == 'x' || pVar->m_szValue[1] == 'X') )
            {
                return (HWND)AU3_HexToDec(&pVar->m_szValue[2]); // Assume hex conversion
            }
            else
                return (HWND)atoi(pVar->m_szValue);

        default:
            return 0;
    }

}

/****************************************************************************
 * AU3_HexToDec()
 ****************************************************************************/

int AU3_HexToDec(const char *szHex)
{
    // Really crappy hex conversion
    int nDec;
    int i, j;
    int nMult;

    i = (int)strlen(szHex) - 1;

    nDec = 0;
    nMult = 1;
    for (j = 0; j < 8; ++j)
    {
        if (i < 0)
            break;

        if (szHex[i] >= '0' && szHex[i] <= '9')
            nDec += (szHex[i] - '0') * nMult;
        else if (szHex[i] >= 'A' && szHex[i] <= 'F')
            nDec += (((szHex[i] - 'A'))+10) * nMult;
        else if (szHex[i] >= 'a' && szHex[i] <= 'f')
            nDec += (((szHex[i] - 'a'))+10) * nMult;
        else
        {
            return 0;
        }

        --i;
        nMult = nMult * 16;
    }

    if (i != -1)
        nDec = 0;

    return nDec;

}

Please let me know if anyone can further assist me in this matter.

Thanks,

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Below is the code that is having the trouble with the compilation errors. (au3plugin.c)

void AU3_FreeVar(AU3_PLUGIN_VAR *pVar)

{

if (pVar == NULL)

return;

AU3_ResetVar(pVar);

free(pVar);

}

does it matter that you have a return statement in functions that are declared as void? Edited by cameronsdad
Link to comment
Share on other sites

How else would you get out of the function pre-maturely? Notice the function isn't returning a value. If it was returning a value, that would be a problem.

i'm not really up on my C or C++, i just seem to remember having issues with returns in methods declared as void in java. As far as exiting prematurely, seems like:

void AU3_FreeVar(AU3_PLUGIN_VAR *pVar)
{
if (pVar != NULL)
{
AU3_ResetVar(pVar);
free(pVar);
}
}

would achieve the same result right?

Link to comment
Share on other sites

Right, it is. However, in large or nested code structures, that may not be usable. Using the return keyword with no argument is valid in a void-returning function.

cool, yeah i wasn't sure but thought it might have had something to do with the errors:

../Plugin_SDK/src/au3plugin.c:30: error: invalid conversion from `void*' to `AU3_PLUGIN_VAR*'

definitely not the first time i've been wrong, and i'd bet it won't be the last...
Link to comment
Share on other sites

Well... I appreciate the comments. Valik, have you used the plugin architecture any to answer my problem? :/

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

code compiles fine under VS. the problem must be with GCC.

Hrm... Okay. I guess I should go back and see if the Dev's C++ example compiles.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Okay... the example that came with the plugin_sdk compiles perfectly under Dev's C++. So now my issues are as follows.

I am trying to compile as C++ is that a problem? I noticed the Plugin_SDK is being compiled as C.

I did notice in the example Dev file the compiler options and such were set, so I copied and pasted those.

I am still not able to get this to work. I am having a different set of errors now.

If anyone has any suggestions comments please let me know. I need help on this.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Well I finally got it to compile. Not sure how this is going to work, because I had a bunch of linking errors. I am unsure why. It is in relation to all the AU3_* functions.

Can someone please help?

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

  • Administrators

Hmm, some bugs in au3plugin.c. I'm suprised that no warnings were given when I compiled, but might be the settings I used.

The first error you posted on line 30 was in the line:

AU3_PLUGIN_VAR *pVar = malloc(sizeof(AU3_PLUGIN_VAR));

All mallocs should be casted to avoid those error. eg.

AU3_PLUGIN_VAR *pVar = (AU3_PLUGIN_VAR * )malloc(sizeof(AU3_PLUGIN_VAR));

All the other errors seem to be the same too. Make similar changes.

Edited by Jon
Link to comment
Share on other sites

Hmm, some bugs in au3plugin.c. I'm suprised that no warnings were given when I compiled, but might be the settings I used.

The first error you posted on line 30 was in the line:

AU3_PLUGIN_VAR *pVar = malloc(sizeof(AU3_PLUGIN_VAR));

All mallocs should be casted to avoid those error. eg.

AU3_PLUGIN_VAR *pVar = (AU3_PLUGIN_VAR * )malloc(sizeof(AU3_PLUGIN_VAR));

All the other errors seem to be the same too. Make similar changes.

Excellent. I will give it a shot. Yea your version compiles fine. I am assuming that C vs C++ doesnt really matter right?

Thanks for the help I will see if that fixes it.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Hrm... here is the following errors that came up. I am sorry this is such a pain. I am including a zip file with all files attached. Jon I know you are busy, I really appreciate the time you have spent to read this topic and reply.

Here are the current errors.

CODE

Compiler: Default compiler

Building Makefile: "C:\Documents and Settings\Jarvis\My Documents\C++\AutoIt\Plugins\File-String Hash\Makefile.win"

Executing make...

make.exe -f "C:\Documents and Settings\Jarvis\My Documents\C++\AutoIt\Plugins\File-String Hash\Makefile.win" all

gcc.exe -c ../Plugin_SDK/src/au3plugin.c -o ../Plugin_SDK/src/au3plugin.o -I"C:/Dev-Cpp/include" -I"C:/Documents and Settings/Jarvis/My Documents/C++/AutoIt/Plugins/Plugin_SDK" -DBUILDING_DLL=1 -fexpensive-optimizations -O1

../Plugin_SDK/src/au3plugin.c: In function `AU3_SetString':

../Plugin_SDK/src/au3plugin.c:89: warning: assignment from incompatible pointer type

../Plugin_SDK/src/au3plugin.c: In function `AU3_GetString':

../Plugin_SDK/src/au3plugin.c:105: warning: assignment from incompatible pointer type

../Plugin_SDK/src/au3plugin.c:133: warning: assignment from incompatible pointer type

dllwrap.exe --output-def libf-shash.def --driver-name c++ --implib libf-shash.a ../Plugin_SDK/src/au3plugin.o dllHash.o JSmd5.o File-String_Hash_private.res -L"C:/Dev-Cpp/lib" --no-export-all-symbols --add-stdcall-alias -s -o f-shash.dll

dllHash.o:dllHash.cpp:(.text+0x3e): undefined reference to `AU3_GetString(tagAU3_PLUGIN_VAR const*)'

dllHash.o:dllHash.cpp:(.text+0x4b): undefined reference to `AU3_GetString(tagAU3_PLUGIN_VAR const*)'

dllHash.o:dllHash.cpp:(.text+0x5f): undefined reference to `AU3_FreeString(char*)'

dllHash.o:dllHash.cpp:(.text+0x67): undefined reference to `AU3_FreeString(char*)'

dllHash.o:dllHash.cpp:(.text+0x6c): undefined reference to `AU3_AllocVar()'

dllHash.o:dllHash.cpp:(.text+0x7a): undefined reference to `AU3_SetString(tagAU3_PLUGIN_VAR*, char const*)'

dllHash.o:dllHash.cpp:(.text+0xbe): undefined reference to `AU3_GetString(tagAU3_PLUGIN_VAR const*)'

dllHash.o:dllHash.cpp:(.text+0xcb): undefined reference to `AU3_GetString(tagAU3_PLUGIN_VAR const*)'

dllHash.o:dllHash.cpp:(.text+0xdf): undefined reference to `AU3_FreeString(char*)'

dllHash.o:dllHash.cpp:(.text+0xe7): undefined reference to `AU3_FreeString(char*)'

dllHash.o:dllHash.cpp:(.text+0xec): undefined reference to `AU3_AllocVar()'

dllHash.o:dllHash.cpp:(.text+0xfa): undefined reference to `AU3_SetString(tagAU3_PLUGIN_VAR*, char const*)'

collect2: ld returned 1 exit status

dllwrap.exe: no export definition file provided.

Creating one, but that may not be what you want

dllwrap.exe: c++ exited with status 1

make.exe: *** [f-shash.dll] Error 1

Execution terminated

Please download the following zipfile containing my entire project.

Edit: I removed everyone but the first cast, and the only problems now are linking errors.

Thanks to everyone who had read the thread.

Jarvis

Edited by JSThePatriot

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

  • Administrators

It's a c/++ problem. They get compiled differently so that c++ functions are confused when calling c functions are vice versa. I'll work around it but the easiest solution atm is to rename au3plugin to .cpp which will force it to compile as c++.

On line 89 the cast should be (char *) btw..

Link to comment
Share on other sites

It's a c/++ problem. They get compiled differently so that c++ functions are confused when calling c functions are vice versa. I'll work around it but the easiest solution atm is to rename au3plugin to .cpp which will force it to compile as c++.

On line 89 the cast should be (char *) btw..

I had set the file to not compile the au3plugin as C++ but as C.

I will try the line 89 deal as well as the .cpp extension.

Your example works perfectly. I just dont understand why I cant copy it.

Thanks again Jon,

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

  • Administrators

I had set the file to not compile the au3plugin as C++ but as C.

JS

That's the problem, all the files need to be compiled with the same. It doesn't matter if they are all c++ or all c but the mixture causes the problem. There is a way around it to tell the compiler how it should "decorate" functions but it involves editing every single function declaration and header so it's easier for you just to make sure that all the files are compiled the same.
Link to comment
Share on other sites

Excellent... after changing the file to .cpp, and (of course making sure it was compiles as C++ again), I also set 88, 104, and 132 with the (char *) casting. Thanks it seems to work. Now to test the plugin.

I think I was also having errors with GetInt32, but I just decided to use a string. I am going to put it back to an integer because my second parameter is supposed to be a number.

Thanks for everything Jon,

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Well so far the plugin works.

THANKS!! LOVE IT!

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...