HELP: Code conversion for AutoIt3 Plugin SDK

New to FreeBASIC? Post your questions here.
Post Reply
bastel123
Posts: 6
Joined: Apr 23, 2006 14:23

HELP: Code conversion for AutoIt3 Plugin SDK

Post by bastel123 »

Hi,

could anybody convert this code to freebasic?
I have no c / c++ knowledge.

Thanx



AU3PLUGIN.H

Code: Select all



#ifndef __AU3PLUGIN_H
#define __AU3PLUGIN_H

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

/* Includes */
#include <windows.h>


/* Defines */
#ifdef __cplusplus
   #define AU3_PLUGINAPI extern "C" __declspec(dllexport)
#else
   #define AU3_PLUGINAPI __declspec(dllexport)
#endif


#define AU3_PLUGIN_OK         0
#define AU3_PLUGIN_ERR         1

#define AU3_PLUGIN_INT32      1            /* 32bit Integer */
#define AU3_PLUGIN_INT64      2            /* 64bit Integer */
#define AU3_PLUGIN_DOUBLE      3            /* Double float */
#define AU3_PLUGIN_STRING      4            /* String */
#define AU3_PLUGIN_HWND         5            /* Handle (Window) */

#define AU3_PLUGIN_ITOA_MAX      65            /* Maximum returned length of an i64toa operation */


/* Variant and plugin function structures */
typedef struct tagAU3_PLUGIN_VAR
{
   int      m_nType;                     /* Type */

   union
   {
      int         m_nValue;               /* Value of int32 (for AU3_PLUGIN_INT32) */
      __int64      m_n64Value;               /* Value of int64 (for AU3_PLUGIN_INT64) */
      double      m_fValue;               /* Value of double (for AU3_PLUGIN_DOUBLE) */
      char      *m_szValue;               /* Value of double (for AU3_PLUGIN_STRING) */
      HWND      m_hWnd;                  /* Value of handle (for AU3_PLUGIN_HWND) */
   };

} AU3_PLUGIN_VAR;


typedef struct tagAU3_PLUGIN_FUNC
{
   char      *m_szName;
   int         m_nMinParams;
   int         m_nMaxParams;

} AU3_PLUGIN_FUNC;


/* Simplified function declarations */
#define AU3_PLUGIN_DEFINE(funcname) AU3_PLUGINAPI int funcname(int n_AU3_NumParams, const AU3_PLUGIN_VAR *p_AU3_Params, AU3_PLUGIN_VAR **p_AU3_Result, int *n_AU3_ErrorCode, int *n_AU3_ExtCode)


/* Helper functions for working with variant like variables */
AU3_PLUGIN_VAR *   AU3_AllocVar(void);
void            AU3_FreeVar(AU3_PLUGIN_VAR *pVar);
void            AU3_ResetVar(AU3_PLUGIN_VAR *pVar);
int               AU3_GetType(AU3_PLUGIN_VAR *pVar);
void            AU3_SetString(AU3_PLUGIN_VAR *pVar, const char *szString);
char *            AU3_GetString(const AU3_PLUGIN_VAR *pVar);
void            AU3_FreeString(char *szString);
void            AU3_SetInt32(AU3_PLUGIN_VAR *pVar, int nValue);
int               AU3_GetInt32(AU3_PLUGIN_VAR *pVar);
void            AU3_SetInt64(AU3_PLUGIN_VAR *pVar, __int64 n64Value);
__int64            AU3_GetInt64(AU3_PLUGIN_VAR *pVar);
void            AU3_SetDouble(AU3_PLUGIN_VAR *pVar, double fValue);
double            AU3_GetDouble(AU3_PLUGIN_VAR *pVar);
void            AU3_SethWnd(AU3_PLUGIN_VAR *pVar, HWND hWnd);
HWND            AU3_GethWnd(AU3_PLUGIN_VAR *pVar);
int               AU3_HexToDec(const char *szHex);



/* END */

#endif




AU3PLUGIN.C

Code: Select all



/*
 *
 * 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;

}

EXAMPLE.C

Code: Select all




/*
 *
 * AutoIt v3 Plugin SDK - Example
 *
 * Copyright (C)1999-2005 Jonathan Bennett <jon at autoitscript dot com>
 *
 * example.c
 *
 */

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

#include "au3plugin.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[] =
{
   {"PluginFunc1", 2, 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;
}


/****************************************************************************
 * PluginFunc1()
 *
 * This is an example function that is a simple message box that takes 2
 * parameters: 
 *
 * PluginFunc1("title", "text")
 *
 ****************************************************************************/

AU3_PLUGIN_DEFINE(PluginFunc1)
{
   /* 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   *pMyResult;
   char         *szTitle, *szText;

   /* 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.
    */
   szTitle   = AU3_GetString(&p_AU3_Params[0]);
   szText   = AU3_GetString(&p_AU3_Params[1]);

   /* Do the message box */
   MessageBox(NULL, szText, szTitle, MB_OK);

   /* Free temporary storage */
   AU3_FreeString(szTitle);
   AU3_FreeString(szText);
   
   /* Allocate and build the return variable */
   pMyResult = AU3_AllocVar();

   /* Set the return variable */
   AU3_SetString(pMyResult, "Hello World");
   /*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      = pMyResult;
   *n_AU3_ErrorCode   = 0;
   *n_AU3_ExtCode      = 0;

   return AU3_PLUGIN_OK;
}

VirusScanner
Posts: 775
Joined: Jul 01, 2005 18:45

Post by VirusScanner »

That's quite a lot of code you got there... here's the header for now.

Code: Select all

#ifndef __AU3PLUGIN_H
#define __AU3PLUGIN_H

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

'' Includes
#include "windows.bi"


'' Defines
'' (Parker-) you don't really need this, since it is changed below to "EXPORT".
#define AU3_PLUGINAPI export


#define AU3_PLUGIN_OK         0
#define AU3_PLUGIN_ERR         1

#define AU3_PLUGIN_INT32      1
#define AU3_PLUGIN_INT64      2
#define AU3_PLUGIN_DOUBLE      3
#define AU3_PLUGIN_STRING      4
#define AU3_PLUGIN_HWND         5

#define AU3_PLUGIN_ITOA_MAX      65


'' Variant and plugin function structures
type as tagAU3_PLUGIN_VAR AU3_PLUGIN_VAR
type tagAU3_PLUGIN_VAR
   as integer m_nType                     '' Type

   union
      as integer m_nValue              '' Value of int32 (for AU3_PLUGIN_INT32)
      as longint m_n64Value               '' Value of int64 (for AU3_PLUGIN_INT64)
      as double m_fValue               '' Value of double (for AU3_PLUGIN_DOUBLE)
      as zstring ptr m_szValue               '' Value of double (for AU3_PLUGIN_STRING)
      as HWND m_hWnd                  '' Value of handle (for AU3_PLUGIN_HWND)
   end union
end type

type as tagAU3_PLUGIN_FUNC AU3_PLUGIN_FUNC
type tagAU3_PLUGIN_FUNC
   as zstring ptr m_szName
   as integer m_nMinParams
   as integer m_nMaxParams
end type


'' Simplified function declarations
#define AU3_PLUGIN_DEFINE(funcname) function funcname(byval n_AU3_NumParams as integer, byval p_AU3_Params as AU3_PLUGIN_VAR ptr, byval p_AU3_Result as AU3_PLUGIN_VAR ptr ptr, byval n_AU3_ErrorCode as integer ptr, byval n_AU3_ExtCode as integer ptr) as integer export


/* Helper functions for working with variant like variables */
declare function AU3_AllocVar( ) as AU3_PLUGIN_VAR ptr
declare sub AU3_FreeVar(byval pVar as AU3_PLUGIN_VAR)
declare sub AU3_ResetVar(byval pVar as AU3_PLUGIN_VAR)
declare function AU3_GetType(byval pVar as AU3_PLUGIN_VAR) as integer
declare sub AU3_SetString(byval pVar as AU3_PLUGIN_VAR, byval szString as zstring ptr)
declare function AU3_GetString(byval pVar as AU3_PLUGIN_VAR) as zstring ptr
declare sub AU3_FreeString(byval szString as zstring ptr)
declare sub AU3_SetInt32(byval pVar as AU3_PLUGIN_VAR, byval nValue as integer)
declare function AU3_GetInt32(byval pVar as AU3_PLUGIN_VAR) as integer
declare sub AU3_SetInt64(byval pVar as AU3_PLUGIN_VAR, byval n64value as longint)
declare function AU3_GetInt64(byval pVar as AU3_PLUGIN_VAR) as longint
declare sub AU3_SetDouble(byval pVar as AU3_PLUGIN_VAR, byval fValue as double)
declare function AU3_GetDouble(byval pVar as AU3_PLUGIN_VAR) as double
declare sub AU3_SethWnd(byval pVar as AU3_PLUGIN_VAR, byval hWnd as HWND)
declare function AU3_GethWnd(byval pVar as AU3_PLUGIN_VAR) as HWND
declare function AU3_HexToDec(byval szHex as zstring ptr) as integer



'' END

#endif
bastel123
Posts: 6
Joined: Apr 23, 2006 14:23

Post by bastel123 »

Thank you VirusScanner,

one question about the declare's:

you wrote e.g.

Code: Select all

void	AU3_FreeVar(AU3_PLUGIN_VAR *pVar);    in c

is

Code: Select all

declare sub AU3_FreeVar(byval pVar as AU3_PLUGIN_VAR)  '   in FB, but

should it not

Code: Select all

declare sub AU3_FreeVar(byval pVar as AU3_PLUGIN_VAR ptr)  

because *pVar is a pointer ?


Sorry for my bad english :(
cha0s
Site Admin
Posts: 5319
Joined: May 27, 2005 6:42
Location: USA
Contact:

Post by cha0s »

The funny thing about that is that FB by default send parameters BYREF (a pointer to the param), which would allow that call to succeed.


in fb

Code: Select all

type foo
  as integer a, b

end type

declare sub some_proc( f as foo )

dim bar as foo

some_proc( bar )
will send a pointer(to bar) to the sub 'my_proc' FB internally dereferences that pointer when you operate on the object sent to the sub.

edit: its personal opinion which is more appropriate, "byval as x ptr" or "byref as x"
bastel123
Posts: 6
Joined: Apr 23, 2006 14:23

Post by bastel123 »

I have translated au3plugin.h and au3plugin.c so far. But i need some help now with the example.c


how can i translate this to fb?
AU3_PLUGIN_FUNC g_AU3_Funcs[NUMFUNCS] =
{
{"PluginFunc1", 2, 2},
{"PluginFunc2", 1, 1},
{"PluginFunc3", 1, 5}
};
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;
}
Sisophon2001
Posts: 1706
Joined: May 27, 2005 6:34
Location: Cambodia, Thailand, Lao, Ireland etc.
Contact:

Post by Sisophon2001 »

This is by first try at your code.

But a word of warning, I don’t know the structure of AU3_PLUGIN_FUNC so I am guessing it is a type, and I don’t know what the macro AU3_PLUGINAPI is, so I am guessing is an alias for standard call.

Garvan

Code: Select all

dim g_AU3_Funcs (0 to NUMFUNCS-1) as AU3_PLUGIN_FUNC => { _
	("PluginFunc1", 2, 2), _
	("PluginFunc2", 1, 1), _
	("PluginFunc3", 1, 5) _
}

function AU3_GetPluginDetails(int *n_AU3_NumFuncs, AU3_PLUGIN_FUNC **p_AU3_Func) as integer
	'' 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
end function
bastel123
Posts: 6
Joined: Apr 23, 2006 14:23

Post by bastel123 »

Thank you Sisophon2001,

i think you are right,

Code: Select all

 #define AU3_PLUGINAPI __declspec(dllexport) 

type as tagAU3_PLUGIN_FUNC AU3_PLUGIN_FUNC
type tagAU3_PLUGIN_FUNC
   as zstring ptr m_szName
   as integer m_nMinParams
   as integer m_nMaxParams
end type
VirusScanner
Posts: 775
Joined: Jul 01, 2005 18:45

Post by VirusScanner »

You can't do
int *n_AU3_NumFuncs, AU3_PLUGIN_FUNC **p_AU3_Func
You should write instead
n_AU3_NumFuncs as integer ptr, p_AU3_Func as AU3_PLUGIN_FUNC ptr ptr
Sisophon2001
Posts: 1706
Joined: May 27, 2005 6:34
Location: Cambodia, Thailand, Lao, Ireland etc.
Contact:

Post by Sisophon2001 »

Yes I missed the function parameter list. And you should use byval also, because FB default is byref.

Code: Select all

function AU3_GetPluginDetails(byval n_AU3_NumFuncs as integer ptr, byval p_AU3_Func as AU3_PLUGIN_FUNC ptr ptr) as integer
Thanks

Garvan
uten
Posts: 7
Joined: May 01, 2006 18:45

Anny freebasic testing tools?

Post by uten »

EDIT: This was realy not suposed to end up here, sorry!
bastel123
Posts: 6
Joined: Apr 23, 2006 14:23

Post by bastel123 »

Thank you for your help, my code is working now :)
piccaso
Posts: 27
Joined: Apr 05, 2006 6:44

Post by piccaso »

could you please post the whole thing again?
(the translated sdk)

thanks
Post Reply