Skip to content

Instantly share code, notes, and snippets.

@theJenix
Forked from larsiusprime/Haxe and C++ problem.md
Created March 21, 2023 01:40
Show Gist options
  • Save theJenix/0eb475f4413831507a3bfc89b02d5b33 to your computer and use it in GitHub Desktop.
Save theJenix/0eb475f4413831507a3bfc89b02d5b33 to your computer and use it in GitHub Desktop.

How do I get string content from Haxe to an untyped cpp block?

static public function haxeFunction(inputString:String)
{
  untyped __cpp__ ('
  
      myStruct myFoo;       
      myFoo.data = ???;   //Should be the string contents of Haxe String inputString (1st 16 characters, ASCII only is fine)
        
  ');
}

Definition of myStruct:

typedef struct myStruct {
    char data[16];
} myStruct;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment