Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6781845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:40:19+00:00 2026-05-26T16:40:19+00:00

So I’ve a collection of C++ classes which I now have converting fine with

  • 0

So I’ve a collection of C++ classes which I now have converting fine with Alchemy to a swc file and can call the exposed functions fine from my AS3 code.

What I’d really like to do is recreate stuff like Box2D’s b2Vec.as class,

public class b2Vec2 extends b2Base {

    public function b2Vec2(p:int) {
        _ptr = p;
    }

    public function get v2():V2 {
        return new V2(x, y);
    }

    public function set v2(v:V2):void {
        x = v.x;
        y = v.y;
    }

    public function get x():Number { return mem._mrf(_ptr + 0); }
    public function set x(v:Number):void { mem._mwf(_ptr + 0, v); }
    public function get y():Number { return mem._mrf(_ptr + 4); }
    public function set y(v:Number):void { mem._mwf(_ptr + 4, v); }

}

This is a simple example, but shows what I’d like to do. On the C side of things, b2Vec2 is a struct,

/// A 2D column vector.
struct b2Vec2
{
    /// Default constructor does nothing (for performance).
    b2Vec2() {}

    ....

    float32 x, y;
};

So, for this struct, it’s easy to calculate that the first variable of a b2Vec2 object is a float, which will be the value in x and can be read via Alchemy’s MemUser classes _mrf (read a fload from a point in memory) with _mrf(pointerAddress) and you can read in the second float with _mrf(pointerAddress + 4).

My question is, if you’re not a C++ expert (me), is there any way to get the definition of a class, as in the addresses of all the variables within and what they are? So, for the b2Vec2 one, I’d imaging it’d be something like,
float32 x 0
float34 y 4
…

The reason I’m asking is because one of the classes in particular has loads of variables and to try and get each and every one’s information so I can access it directly from the AS3 code would be lots of work and I’m going to assume I’ll introduce plenty of human error to it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T16:40:20+00:00Added an answer on May 26, 2026 at 4:40 pm

    I actually got a good enough answer from the WCK guy, Jesse Sternberg. He got most of his AS3 classes that are paired with their C++ counterparts are done automatically during the build process in his own ‘probe’ folder. In there, there’s one Box2D.c class that defines a load of templates at the top, then in the main function, probes classes for member variables and that prints out the relevant AS3 code for accessing them from that side.

    It’s a little bit funky to get used to, but certainly very handy and much better than doing it manually!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have a text area in my form which accepts all possible characters from
I have a reasonable size flat file database of text documents mostly saved in
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I want use html5's new tag to play a wav file (currently only supported

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.