Hello all...<div><br></div><div>I'm trying to create a simple language that supports classes using the OCaml API.</div><div><br></div><div>When I use the web page demo to produce the intermediate code for the following C++ example ...</div>
<div><br></div><div><div>class MyClass {</div><div> public:</div><div>   MyClass();</div><div>   int c;</div><div>};</div><div><br></div><div>MyClass::MyClass () {</div><div> c=55;</div><div>}</div></div><div><br></div><div>
...I get something like this ....</div><div><span class="Apple-style-span" style="font-family:Times;font-size:medium"><pre><span>%class.MyClass = <span class="llvm_type" style="font-style:oblique;color:green">type</span> { <span class="llvm_type" style="font-style:oblique;color:green">i32</span> }

@MyClass::MyClass() = <span class="llvm_keyword" style="font-weight:bold;color:blue">alias</span> <span class="llvm_type" style="font-style:oblique;color:green">void</span> (%class.MyClass*)* @MyClass::MyClass()

<span class="llvm_keyword" style="font-weight:bold;color:blue">define</span> <span class="llvm_type" style="font-style:oblique;color:green">void</span> @MyClass::MyClass()(%class.MyClass* %this) unnamed_addr <span class="llvm_keyword" style="font-weight:bold;color:blue">nounwind</span> uwtable <span class="llvm_keyword" style="font-weight:bold;color:blue">align</span> 2 {
  %1 = <span class="llvm_keyword" style="font-weight:bold;color:blue">alloca</span> %class.MyClass*, <span class="llvm_keyword" style="font-weight:bold;color:blue">align</span> 8
  <span class="llvm_keyword" style="font-weight:bold;color:blue">store</span> %class.MyClass* %this, %class.MyClass** %1, <span class="llvm_keyword" style="font-weight:bold;color:blue">align</span> 8
  %2 = <span class="llvm_keyword" style="font-weight:bold;color:blue">load</span> %class.MyClass** %1
  %3 = <span class="llvm_keyword" style="font-weight:bold;color:blue">getelementptr</span> inbounds %class.MyClass* %2, <span class="llvm_type" style="font-style:oblique;color:green">i32</span> 0, <span class="llvm_type" style="font-style:oblique;color:green">i32</span> 0
  <span class="llvm_keyword" style="font-weight:bold;color:blue">store</span> <span class="llvm_type" style="font-style:oblique;color:green">i32</span> 55, <span class="llvm_type" style="font-style:oblique;color:green">i32</span>* %3, <span class="llvm_keyword" style="font-weight:bold;color:blue">align</span> 4
  <span class="llvm_keyword" style="font-weight:bold;color:blue">ret</span> <span class="llvm_type" style="font-style:oblique;color:green">void</span>
}</span></pre></span>...however I didn't see any function in the API that generates the named type command that is produced in the result.</div><div><br></div><div>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.</div>
<div><br></div><div>Thanks,</div><div>Frank<br><span class="Apple-style-span" style="font-family:Times;font-size:medium"><pre><br></pre></span></div>