# UXP engine in c++ plugin?

**URL:** <https://forums.creativeclouddeveloper.com/t/uxp-engine-in-c-plugin/7356>\
**Category:** Photoshop\
**Created:** [January 13, 2024, 2:44pm UTC](https://forums.creativeclouddeveloper.com/t/uxp-engine-in-c-plugin/7356 "2024-01-13T14:44:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dariusz](https://avatars.discourse-cdn.com/v4/letter/d/7ea924/32.png) [@Dariusz](https://forums.creativeclouddeveloper.com/u/Dariusz)\
**Post date:** [January 13, 2024, 2:44pm UTC](https://forums.creativeclouddeveloper.com/t/uxp-engine-in-c-plugin/7356/1 "2024-01-13T14:44:42Z")

</div>

Hello

We have a production workflow where all our plugins start in c++ code base.  
Our current workflow is as follow

1.Rapid Development = c++ plugin creating

```auto
sScriptingSuite->CreateEngine(&engineRef);

```

We usually pass to it a string-string to execute and use return string as json object to read it result.  
Our main usage of it is prototyping/development  
2. C++ performance, once script is developed in method 1. if needed we convert it to pure c++ for speed.

With UPX there is no UPX engine that we can create in c++, is it possible now/in future to create UPX engine in c++ plugin where we can manage it, pass it code/for execution etc ?  
We would like to add UPX as another option for rapid script development alongside javascript engine now. Is this possible?

Regards  
Dariusz

---

<div class="post-metadata">

**Author:** ![nagendra](https://avatars.discourse-cdn.com/v4/letter/n/9fc29f/32.png) [@nagendra](https://forums.creativeclouddeveloper.com/u/nagendra)\
**Post date:** [January 16, 2024, 9:20am UTC](https://forums.creativeclouddeveloper.com/t/uxp-engine-in-c-plugin/7356/2 "2024-01-16T09:20:59Z")

</div>

I believe you meant UXP, not UPX. If so, UXP does support hybrid plugins in Photoshop. You can find more information about this in the ‘Hybrid Plugins’:

> **[Adobe UXP Hybrid plugin](https://developer.adobe.com/photoshop/uxp/2022/guides/hybrid-plugins/)**
>
> A UXP Hybrid plugin is a UXP plugin combined with the power of C++ native libraries.

Please check that out and let me know if it addresses your requirements. If you have any further questions or need clarification, feel free to ask.

---

<div class="post-metadata">

**Author:** ![Dariusz](https://avatars.discourse-cdn.com/v4/letter/d/7ea924/32.png) [@Dariusz](https://forums.creativeclouddeveloper.com/u/Dariusz)\
**Post date:** [January 16, 2024, 9:36am UTC](https://forums.creativeclouddeveloper.com/t/uxp-engine-in-c-plugin/7356/3 "2024-01-16T09:36:30Z")

</div>

Oh yes you are correct, tricky naming…  
Regardless question stands. Still need help/clarification on it.

---

<div class="post-metadata">

**Author:** ![nagendra](https://avatars.discourse-cdn.com/v4/letter/n/9fc29f/32.png) [@nagendra](https://forums.creativeclouddeveloper.com/u/nagendra)\
**Post date:** [January 16, 2024, 9:40am UTC](https://forums.creativeclouddeveloper.com/t/uxp-engine-in-c-plugin/7356/4 "2024-01-16T09:40:31Z")

</div>

Sure, Please go through the documentation and post your queries.

---

<div class="post-metadata">

**Author:** ![Dariusz](https://avatars.discourse-cdn.com/v4/letter/d/7ea924/32.png) [@Dariusz](https://forums.creativeclouddeveloper.com/u/Dariusz)\
**Post date:** [January 16, 2024, 10:21am UTC](https://forums.creativeclouddeveloper.com/t/uxp-engine-in-c-plugin/7356/5 "2024-01-16T10:21:31Z")

</div>

Hello  
I’ve rechecked documentation sdk.  
c++ sdk \>

```auto
typedef struct PsUXPSuite1
{
    SPAPI SPErr (*SendUXPMessage) (SPPluginRef selfRef, const char* uxpPluginId, PIActionDescriptor descriptor);
    
    SPAPI SPErr (*AddUXPMessageListener) (SPPluginRef selfRef, PIUXPMessageNotifier notifier);
    
    SPAPI SPErr (*RemoveUXPMessageListener) (SPPluginRef selfRef);

} PsUXPSuite1;

```

I don’t see anything resembling engine creation or script execution like in \>

```auto
typedef struct {

	///	Returns true if any of the published scripting engines is currently executing a script.
	ASAPI ASBoolean	(*ScriptIsRunning) ( void );

	///	Creates a new instance of a JavaScript Engine.
	ASAPI ASErr (*CreateEngine) ( JSEngineRef * engineRefPtr );
	
	///	Disposes of a JavaScript Engine instance.
	ASAPI ASErr (*DeleteEngine) ( JSEngineRef engineRef );

	/**	Set the default search path(s) for include files encountered in script files executed by 
	*	an engine. This string contains all include directories, separated by the colon or the
	*	semicolon characters. **/
	ASAPI ASErr (*SetIncludePath) ( JSEngineRef engineRef, const ASUnicode * includePath );
	
	/**	Get the default search path(s) for include files encountered in script files executed by 
	*	an engine.  
	*
	* buffSize size, in ASUnicode characters, of the includePathBuff being passed in.
	* If get fails, buffSize will contain the required size for the buffer to contain the entire path string. **/
	ASAPI ASErr (*GetIncludePath) ( JSEngineRef engineRef, ASUnicode * includePathBuff, long * buffSize );

	/**	Execute a JavaScript script
			@param engineRef Engine with which to execute JavaScript script, acquired from CreateEngine.
			@param script unicode text of the JavaScript script to be executed.
			@param executionMode If kJSExecutionModeRun then the JavaScript is executed normally, if kJSExecutionModeDebug then the JavaScript is halted at the first line and the debugger Ui is shown
			@param result Pointer to result of execution. If an execution error occured, the returned string will contain error information.
			@returns kSPNoError Success. kJSScriptExecutionError Additional information available in result string.
	**/
	ASAPI ASErr (*ExecuteScript) ( JSEngineRef engineRef,
								   const ASUnicode * script,
								   JavaScriptExecutionMode	executionMode,
								   const ASUnicode ** result );

	//@}
	///@name New in 12.0 version 2 of the suite
	//@{

	///	Creates a new instance of a JavaScript Engine with an APE reference for High Bandwidth API
	ASAPI ASErr (*CreateEngineAPE) ( JSEngineRef * engineRefPtr, intptr_t apeEngineRef );

} JSScriptingSuite2;

```

To be specific \>

```auto
	ASAPI ASErr (*CreateEngine) ( JSEngineRef * engineRefPtr );
	ASAPI ASErr (*DeleteEngine) ( JSEngineRef engineRef );
	ASAPI ASErr (*ExecuteScript) ( JSEngineRef engineRef,
								   const ASUnicode * script,
								   JavaScriptExecutionMode	executionMode,
								   const ASUnicode ** result );

```

So as it stands, we can’t create UXP engine nor give it custom code as unicode, We don’t even need to create new engine, but we need to be able to give it custom code to execute directly.

Can this be supported?

---

<div class="post-metadata">

**Author:** ![DavideBarranca](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/davidebarranca/32/1523_2.png) [@DavideBarranca](https://forums.creativeclouddeveloper.com/u/DavideBarranca)\
**Post date:** [January 17, 2024, 9:11am UTC](https://forums.creativeclouddeveloper.com/t/uxp-engine-in-c-plugin/7356/6 "2024-01-17T09:11:51Z")

</div>

Linking the newest reply by Jesper Storm Bache (Adobe) in the [original thread](https://community.adobe.com/t5/photoshop-ecosystem-discussions/action-manager-update/m-p/14360190#M775545).
