<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="Helvetica, Arial, sans-serif">Dear FPC devlopers,<br>
can somebody point me to the simplest implementation of .SO (in C++)
which can call the method of CORBA interface passed to the DLL.<br>
Interface itself passed from FPC program.<br>
<br>
I'm trying to write plugin in CPP (DLL, SO) which on intialisation
gets the Interface pointer to the Application API from host process.<br>
<br>
Doing so in FPC is easy and straightforward under all platform II tried
(win32-i386, x86_64-linux).<br>
<br>
</font>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<span class="Apple-style-span"
style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;">
<pre><strong>function</strong> <font color="#2040a0">cnvImportEx</font><font
color="#4444ff">(</font><font color="#2040a0">nFormatId</font><font
color="#4444ff">:</font><font color="#2040a0">integer</font><font
color="#4444ff">;</font> <strong>const</strong> <font color="#2040a0">FileName</font><font
color="#4444ff">:</font><font color="#2040a0">PChar</font><font
color="#4444ff">;</font><font color="#2040a0">hSp</font><font
color="#4444ff">:</font><font color="#2040a0">IUnknown</font><font
color="#4444ff">)</font><font color="#4444ff">:</font><font
color="#2040a0">integer</font><font color="#4444ff">;</font>
<strong>var</strong>
<font color="#2040a0"> i</font><font color="#4444ff">:</font><font
color="#2040a0">integer</font><font color="#4444ff">;</font>
<font color="#2040a0">uc</font><font color="#4444ff">:</font><font
color="#2040a0">IMyApplicationAPI</font><font color="#4444ff">; // <b>API interface</b></font>
<font color="#2040a0">vv</font><font color="#4444ff">:</font><font
color="#2040a0">variant</font><font color="#4444ff">;</font>
<strong>begin</strong>
<font color="#2040a0">Result</font><font color="#4444ff">:</font><font
color="#4444ff">=</font><font color="#2040a0">CNV_FAIL</font><font
color="#4444ff">;</font>
<strong>if</strong> <font color="#2040a0">Assigned</font><font
color="#4444ff">(</font><font color="#2040a0">hSp</font><font
color="#4444ff">)</font> <strong>then</strong>
<strong>begin</strong>
<font color="#2040a0">uc</font><font color="#4444ff">:</font><font
color="#4444ff">=</font><font color="#2040a0">hSp</font> <font
color="#2040a0">as</font><font color="#2040a0"> MyApplicationAPI; </font><font
color="#4444ff"><b>// implicit QueryInterface</b></font>
<font color="#2040a0">vv</font><font color="#4444ff">:</font><font
color="#4444ff">=</font><font color="#008000">'Test'</font><font
color="#4444ff">;</font>
<font color="#2040a0">uc<font color="#4444ff">.</font>SetPropValue</font><font
color="#4444ff">(</font><font color="#4444ff">-</font><font
color="#ff0000">1</font>,<font color="#008000">'Name'</font>,@<font
color="#2040a0">vv</font><font color="#4444ff">)</font><font
color="#4444ff">;</font>
<font color="#2040a0">vv</font><font color="#4444ff">:</font><font
color="#4444ff">=</font><font color="#2040a0">false</font><font
color="#4444ff">;</font>
<font color="#2040a0">uc<font color="#4444ff">.</font>SetPropValue</font><font
color="#4444ff">(</font><font color="#4444ff">-</font><font
color="#ff0000">1</font>,<font color="#008000">'Lock'</font>,@<font
color="#2040a0">vv</font><font color="#4444ff">)</font><font
color="#4444ff">;</font>
<font color="#2040a0">vv</font><font color="#4444ff">:</font><font
color="#4444ff">=</font><font color="#ff0000">1000</font><font
color="#4444ff">;</font>
<font color="#2040a0">uc<font color="#4444ff">.</font>SetPropValue</font><font
color="#4444ff">(</font><font color="#ff0000">1</font>,<font
color="#008000">'Size'</font>,@<font color="#2040a0">vv</font><font
color="#4444ff">)</font><font color="#4444ff">;</font>
<strong>for</strong> <font color="#2040a0">i</font><font
color="#4444ff">:</font><font color="#4444ff">=</font><font
color="#ff0000">1</font> <strong>to</strong> <font color="#ff0000">1000</font> <strong>do</strong>
<font color="#2040a0">uc<font color="#4444ff">.</font>SetData</font><font
color="#4444ff">(</font><font color="#ff0000">1</font>,<font
color="#2040a0">i</font>,<font color="#ff0000">1000</font><font
color="#4444ff">*</font><font color="#2040a0">sin</font><font
color="#4444ff">(</font><font color="#ff0000">0.11</font><font
color="#4444ff">*</font><font color="#2040a0">i</font><font
color="#4444ff">)</font><font color="#4444ff">)</font><font
color="#4444ff">;</font>
<font color="#2040a0">Result</font><font color="#4444ff">:</font><font
color="#4444ff">=</font><font color="#2040a0">CNV_OK</font><font
color="#4444ff">;</font>
<strong>end</strong><font color="#4444ff">;</font>
<strong>end</strong><font color="#4444ff">;</font></pre>
</span><font face="Helvetica, Arial, sans-serif">How to do the same
Hell in C++?<br>
<br>
With best regards.</font><br>
</body>
</html>