Supporting Classes using OCaml.

Hello all…

I’m trying to create a simple language that supports classes using the OCaml API.

When I use the web page demo to produce the intermediate code for the following C++ example …

class MyClass {
int c;

MyClass::MyClass () {

…I get something like this …

%class.MyClass = type { i32 }

@MyClass::MyClass() = alias void (%class.MyClass*)* @MyClass::MyClass()

define void @MyClass::MyClass()(%class.MyClass* %this) unnamed_addr nounwind uwtable align 2 {
  %1 = alloca %class.MyClass*, align 8
  store %class.MyClass* %this, %class.MyClass** %1, align 8
  %2 = load %class.MyClass** %1
  %3 = getelementptr inbounds %class.MyClass* %2, i32 0, i32 0
  store i32 55, i32* %3, align 4
  ret void

…however I didn’t see any function in the API that generates the named type command that is produced in the result.

Is there an OCaml function which emits code for named structure types? Or this there a means of obtaining an equivalent result. Any comments would be greatly appreciated.