<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="margin:0px;font-size:12pt;background-color:rgb(255, 255, 255)">Hello,</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<div style="margin:0px;font-size:12pt;background-color:rgb(255, 255, 255)"><br>
</div>
<div style="margin:0px;font-size:12pt;background-color:rgb(255, 255, 255)">I am trying to use SIP to wrap a pure virtual class. Since it does not have a callable constructor, it instead has a static factory function that returns an instance of a hidden subclass.</div>
<div style="margin:0px;font-size:12pt;background-color:rgb(255, 255, 255)"><br>
</div>
<div style="margin:0px;font-size:12pt;background-color:rgb(255, 255, 255)">From the docs, I've gathered that SIP provides %InstanceCode to cover this use case, but it appears it's not doing anything. My class is defined in my .sip file like so:</div>
<div style="margin:0px;font-size:12pt;background-color:rgb(255, 255, 255)"><br>
</div>
<div style="margin:0px;font-size:12pt;background-color:rgb(255, 255, 255)"></div>
<div style="margin:0px;font-size:15px;font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;color:rgb(32, 31, 30);background-color:rgb(255, 255, 255)">
class MyLib</div>
<div style="margin:0px;font-size:15px;font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;color:rgb(32, 31, 30);background-color:rgb(255, 255, 255)">
{</div>
<div style="margin:0px;font-size:15px;font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;color:rgb(32, 31, 30);background-color:rgb(255, 255, 255)">
%TypeHeaderCode</div>
<div style="margin:0px;font-size:15px;font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;color:rgb(32, 31, 30);background-color:rgb(255, 255, 255)">
#include <MyLib.h></div>
<div style="margin:0px;font-size:15px;font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;color:rgb(32, 31, 30);background-color:rgb(255, 255, 255)">
%End</div>
<div style="margin:0px;font-size:15px;font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;color:rgb(32, 31, 30);background-color:rgb(255, 255, 255)">
%InstanceCode</div>
<div style="margin:0px;font-size:15px;font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;color:rgb(32, 31, 30);background-color:rgb(255, 255, 255)">
    sipCpp = ::MyLib::Create();</div>
<div style="margin:0px;font-size:15px;font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;color:rgb(32, 31, 30);background-color:rgb(255, 255, 255)">
%End</div>
<span style="color:rgb(32, 31, 30);font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;font-size:15px;background-color:rgb(255, 255, 255);display:inline !important">};</span>
<div style="margin:0px;font-size:12pt;background-color:rgb(255, 255, 255)"><br>
</div>
<div style="margin:0px;font-size:12pt;background-color:rgb(255, 255, 255)">But there is no change in the CPP code that SIP generates, whether I include the %InstanceCode or not; it's still trying to call my class's constructor directly, and I can't find my
 call to Create() anywhere in the generated code.</div>
<div style="margin:0px;font-size:12pt;background-color:rgb(255, 255, 255)"><br>
</div>
<div style="margin:0px;font-size:12pt;background-color:rgb(255, 255, 255)">Am I misunderstanding how %InstanceCode is supposed to work?</div>
<div style="margin:0px;font-size:12pt;background-color:rgb(255, 255, 255)"><br>
</div>
<span style="margin:0px;font-size:12pt;background-color:rgb(255, 255, 255)">Thanks very much for any help!</span><br>
</div>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="Signature">
<div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<pre style="orphans:auto; widows:auto">-- <br></pre>
<div style="font-family:Cantarell; font-size:14.666666984558105px; font-weight:normal; orphans:auto; widows:auto">
<p style="margin:0in 0in 0.0001pt; font-family:Calibri,sans-serif"><b><span style="font-size:12pt; color:rgb(31,73,125)">James Jurack</span></b></p>
<p style="margin:0in 0in 0.0001pt; font-family:Calibri,sans-serif; line-height:18.33333396911621px">
<span style="color:rgb(31,73,125)">Systems Engineer</span></p>
<p style="margin:0in 0in 0.0001pt; font-family:Calibri,sans-serif; line-height:18.33333396911621px">
<span style="color:rgb(31,73,125)"><img class="EmojiInsert" data-outlook-trace="F:1|T:1" src="cid:fb44a353-f222-4d6f-916f-b787ae52e8fa"></span><span style="color:rgb(31,73,125)">                                                                               
                  <img class="EmojiInsert" data-outlook-trace="F:1|T:1" src="cid:66a639b5-c3f2-4379-bf03-21abfc8848ff"></span></p>
<p style="margin:0in 0in 0.0001pt; font-family:Calibri,sans-serif"><span style="color:rgb(31,73,125)">5425 Warner Rd. </span><b><span style="color:red">| </span></b><span style="color:rgb(31,73,125)">Suite 13 </span><b><span style="color:red">|</span></b><span style="color:rgb(31,73,125)"> Valley
 View, OH 44125 </span><b><span style="color:red">|</span></b><span style="color:rgb(31,73,125)"> <a href="http://www.vtiinstruments.com/" style="color:purple">http://www.vtiinstruments.com</a></span></p>
<p style="margin:0in 0in 0.0001pt; font-family:Calibri,sans-serif; line-height:22px">
<span style="color:rgb(31,73,125)">P. +1.216.447.8950 x2013 </span><b><span style="color:red">|</span></b><span style="color:rgb(31,73,125)"> F: +1.216.447.8951 </span><b><span style="color:red">|</span></b><span style="color:rgb(31,73,125)"> <a href="mailto:email@vtiinstruments.com" style="color:purple">james.jurack@ametek.com</a></span></p>
</div>
<br>
</div>
</div>
</div>
</div>
</body>
</html>