Calvindd2f / executor

2 stars 0 forks source link

Experimental #9

Closed Calvindd2f closed 5 days ago

Calvindd2f commented 5 days ago
  1. The Callbacks struct is now defined in the header file (PowerShellExecutor.h).
  2. LogManagedException is now implemented in the cpp file.
  3. DeserializeScriptVariables is implemented as a placeholder. You'll need to add the actual deserialization logic based on your specific requirements.
  4. The C++/CLI version still uses managed types, but we've added marshaling where necessary to interact with unmanaged code (e.g., in the SendLog method).

To use this implementation:

  1. Include both the PowerShellExecutor.h and PowerShellExecutor.cpp files in your project.
  2. Ensure that the PowerShellRuntimeExtensions20.dll is in the correct location or its path is properly specified.
  3. When creating a PowerShellExecutor instance, pass the appropriate callback pointer from your native code.

This implementation should now be more consistent with the C# version while maintaining C++/CLI functionality.

The use of managed types (String^, gcnew, etc.) is still present, as these are necessary for interacting with the PowerShell API in C++/CLI.

However, we've added marshaling where needed to bridge the gap between managed and unmanaged code. Remember to implement the actual deserialization logic in the DeserializeScriptVariables method according to your specific requirements for handling input variables.