I managed to pass a string, here is the code that worked
The documentation was especially helpful
https://extendscript.docsforadobe.dev/integrating-external-libraries/defining-entry-points-for-indirect-access.html
https://extendscript.docsforadobe.dev/integrating-external-libraries/defining-entry-points-for-direct-access.html
Plugin code
#include "SaveImage.h"
#include <Windows.h>
#define kTypeString 4 // Define the type constant for strings
static AEGP_PluginID S_my_id = 0L;
static SPBasicSuite* sP = NULL;
// TaggedData structure (provided by Adobe) https://extendscript.docsforadobe.dev/integrating-external-libraries/defining-entry-points-for-indirect-access.html
typedef struct {
union {
long intval; // Integer value
double fltval; // Floating-point value
char* string; // String value
} data; // Data field
long type; // Data type
long filler; // Padding for alignment
} TaggedData;
// Exported function for JavaScript to call
extern "C" __declspec(dllexport) long processString(
TaggedData * argv,
long argc,
TaggedData * retval)
{
// Extract the string from the arguments
const char* receivedString = argv[0].data.string;
// Debug
MessageBoxA(NULL, receivedString, "Received String", MB_OK);
return 0;
}
A_Err EntryPointFunc(
struct SPBasicSuite* pica_basicP,
A_long major_versionL,
A_long minor_versionL,
AEGP_PluginID aegp_plugin_id,
AEGP_GlobalRefcon* global_refconV)
{
S_my_id = aegp_plugin_id;
sP = pica_basicP;
return A_Err_NONE;
}
Extension code
var pluginPath = "C:/Program Files/Adobe/Common/Plug-ins/7.0/MediaCore/SaveImage/";
var libFilename = "SaveImage.aex";
var pluginLib = new ExternalObject("lib:" + pluginPath + libFilename);
var command = "My text";
var result = pluginLib.processString(command);
pluginLib.unload();