Advertisement
RamireDu06

Untitled

Sep 22nd, 2019
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.08 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <string>
  3. #include <cstring>
  4. #include <sstream>
  5. extern "C"
  6. {
  7.     __declspec(dllexport) void __stdcall RVExtension(char *output, int outputSize, const char *function);
  8.     __declspec(dllexport) int __stdcall RVExtensionArgs(char *output, int outputSize, const char *function, const char **argv, int argc);
  9.     __declspec(dllexport) void __stdcall RVExtensionVersion(char *output, int outputSize);
  10. }
  11.  
  12. void __stdcall RVExtension(char *output, int outputSize, const char *function)
  13. {
  14.     if (function == "test1") {
  15.         std::strncpy(output, "test1", outputSize - 1);
  16.     }
  17.     else if (function == "test2") {
  18.         std::strncpy(output, "test2", outputSize - 1);
  19.     }
  20. }
  21.  
  22. int __stdcall RVExtensionArgs(char *output, int outputSize, const char *function, const char **argv, int argc)
  23. {
  24.     std::stringstream sstream;
  25.     for (int i = 0; i < argc; i++)
  26.     {
  27.         sstream << argv[i];
  28.     }
  29.  
  30.     std::strncpy(output, sstream.str().c_str(), outputSize - 1);
  31.     return 0;
  32. }
  33.  
  34. void __stdcall RVExtensionVersion(char *output, int outputSize)
  35. {
  36.     std::strncpy(output, "Test-Extension v1.0", outputSize - 1);
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement