<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>EvoTalk &#187; dll</title>
	<atom:link href="http://evotalk.net/blog/tag/dll/feed" rel="self" type="application/rss+xml" />
	<link>http://evotalk.net/blog</link>
	<description></description>
	<lastBuildDate>Mon, 07 Jun 2010 03:01:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Perl Call VC Dll</title>
		<link>http://evotalk.net/blog/2009/01/perl-call-vc-dll.html</link>
		<comments>http://evotalk.net/blog/2009/01/perl-call-vc-dll.html#comments</comments>
		<pubDate>Tue, 20 Jan 2009 09:21:48 +0000</pubDate>
		<dc:creator>asd</dc:creator>
				<category><![CDATA[Code Snippet]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[程式設計]]></category>
		<category><![CDATA[dll]]></category>

		<guid isPermaLink="false">http://evotalk.net/blog/?p=1169</guid>
		<description><![CDATA[VC DLL實作，calling convention 必需是__stdcall 
view plain

CODE:




#include &#38;lt;windows.h&#38;gt;


#include &#38;lt;stdio.h&#38;gt;


&#160;


int __stdcall GetIntFromVC&#40;int x &#41;


&#123;


    x *= 2;


    return x;


&#125;


&#160;


int  __stdcall GetStrFromVC&#40;char* pbstr, char *lpBuffer&#41;


&#123;


 return sprintf&#40;lpBuffer, "*** %s ***", pbstr&#41;;


&#125; 







避免 name mangling ，加入 .def
view plain

CODE:




LIBRARY test


&#160;


EXPORTS


GetIntFromVC  @1


GetStrFromVC  @2 







Perl call dll
view plain

CODE:




#! perl -slw


use strict;


use Win32::API;


&#160;


#傳入一個參數，回傳一個值 ，N: value is a number &#40;long&#41;


my $fun1 = new Win32::API&#40;'test.dll', 'GetIntFromVC', [...]]]></description>
			<content:encoded><![CDATA[<p>VC DLL實作，<strong><span style="color: #ff0000;">calling convention 必需是__stdcall </span></strong></p>
<div class="igBar"><span id="lcode-4"><a href="#" onclick="javascript:showCodeTxt('code-4'); return false;">view plain</a></span></div>
<div class="shadow">
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-4">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#include &amp;lt;windows.<span style="">h</span>&amp;gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#include &amp;lt;stdio.<span style="">h</span>&amp;gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">int __stdcall GetIntFromVC<span style="color:#006600; font-weight:bold;">&#40;</span>int x <span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    x *= <span style="color:#800000;color:#800000;">2</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    return x;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">int  __stdcall GetStrFromVC<span style="color:#006600; font-weight:bold;">&#40;</span>char* pbstr, char *lpBuffer<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> return sprintf<span style="color:#006600; font-weight:bold;">&#40;</span>lpBuffer, <span style="color:#CC0000;">"*** %s ***"</span>, pbstr<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
</div>
<p>
避免 name mangling ，加入 .def</p>
<div class="igBar"><span id="lcode-5"><a href="#" onclick="javascript:showCodeTxt('code-5'); return false;">view plain</a></span></div>
<div class="shadow">
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-5">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">LIBRARY test</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">EXPORTS</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">GetIntFromVC  @<span style="color:#800000;color:#800000;">1</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">GetStrFromVC  @<span style="color:#800000;color:#800000;">2</span> </div>
</li>
</ol>
</div>
</div>
</div>
</div>
<p></p>
<p>Perl call dll</p>
<div class="igBar"><span id="lcode-6"><a href="#" onclick="javascript:showCodeTxt('code-6'); return false;">view plain</a></span></div>
<div class="shadow">
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-6">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#! perl -slw</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">use strict;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">use Win32::<span style="">API</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#傳入一個參數，回傳一個值 ，N: value is a number <span style="color:#006600; font-weight:bold;">&#40;</span>long<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">my $fun1 = new Win32::<span style="">API</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'test.dll'</span>, <span style="color:#CC0000;">'GetIntFromVC'</span>, <span style="color:#CC0000;">'N'</span>, <span style="color:#CC0000;">'N'</span><span style="color:#006600; font-weight:bold;">&#41;</span> or die $^E;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#傳入二個參數，回傳 一個參數，P: value is a pointer <span style="color:#006600; font-weight:bold;">&#40;</span>to a string, structure, etc...<span style="color:#006600; font-weight:bold;">&#41;</span>，N: value is a number <span style="color:#006600; font-weight:bold;">&#40;</span>long<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">my $fun2 = new Win32::<span style="">API</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'test.dll'</span>, <span style="color:#CC0000;">'GetStrFromVC'</span>, <span style="color:#CC0000;">'PP'</span>, <span style="color:#CC0000;">'N'</span><span style="color:#006600; font-weight:bold;">&#41;</span> or die $^E;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">print $fun1-&amp;gt;Call<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">123</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">my $lpBuffer = <span style="color:#CC0000;">" "</span> x <span style="color:#800000;color:#800000;">100</span>;        #配置足夠的空間</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$fun2-&amp;gt;Call<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"hello world"</span>, $lpBuffer<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$lpBuffer =~ s/\<span style="color:#800000;color:#800000;">0</span>.*$<span style="color:#FF9933; font-style:italic;">//;        #刪除多餘的空白</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">print <span style="color:#CC0000;">"$lpBuffer"</span>; </div>
</li>
</ol>
</div>
</div>
</div>
</div>
<p></p>
<p>參考</p>
<ul>
<li><a href="http://chaoslawful.bokee.com/918884.html" target="_blank">使用Win32::API模块导入DLL中函数的注意事项</a></li>
<li><a href="http://kobesearch.cpan.org/htdocs/Win32-API/Win32/API.html" target="_blank">Win32::API - Perl Win32 API Import Facility</a></li>
<li><a href="http://www.perlmonks.org/?node_id=176808" target="_blank">Calling a C API in a dll from Perl on Windows</a></li>
<li><a href="http://search.cpan.org/~acalpini/Win32-API-0.41/API.pm" target="_blank">Win32::API </a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://evotalk.net/blog/2009/01/perl-call-vc-dll.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VB Pass String to VC Dll</title>
		<link>http://evotalk.net/blog/2006/06/vb-pass-string-to-vc-dll.html</link>
		<comments>http://evotalk.net/blog/2006/06/vb-pass-string-to-vc-dll.html#comments</comments>
		<pubDate>Thu, 29 Jun 2006 14:10:48 +0000</pubDate>
		<dc:creator>asd</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Code Snippet]]></category>
		<category><![CDATA[程式設計]]></category>
		<category><![CDATA[dll]]></category>
		<category><![CDATA[vb]]></category>
		<category><![CDATA[vc]]></category>

		<guid isPermaLink="false">http://evotalk.net/blog/?p=267</guid>
		<description><![CDATA[In VC DLL

function 前不需要加入 __declspec(dllexport)，要匯出的function名稱加入 .def 即可，避免name mangling
function 之 calling convertion 為 __stdcall
ex. int __stdcall GetCPUSpeed()
使用.def 作出的 Dll，可被 VC 及 VB 程式呼叫

VB 傳參數進 VC DLL
例一 : Call By Reference
In VB，若function宣告為
Private Declare Function GetStrFromVC1 "z:DllDebugDll2.dll" ( ByRef PA as integer, ByRef str1 as String) As String
呼叫
view plain

Visual Basic:




Dim strRet as String


Dim PA as Integer


Dim strOutStr as [...]]]></description>
			<content:encoded><![CDATA[<p>In VC DLL</p>
<ol>
<li>function 前不需要加入 __declspec(dllexport)，要匯出的function名稱加入 .def 即可，避免name mangling</li>
<li>function 之 calling convertion 為 __stdcall<br />
ex. int __stdcall GetCPUSpeed()</li>
<li>使用.def 作出的 Dll，可被 VC 及 VB 程式呼叫</li>
</ol>
<h5>VB 傳參數進 VC DLL</h5>
<p>例一 : Call By Reference<br />
In VB，若function宣告為</p>
<blockquote><p>Private Declare Function GetStrFromVC1 "z:DllDebugDll2.dll" ( ByRef PA as integer, ByRef str1 as String) As String</p></blockquote>
<p>呼叫</p>
<div class="igBar"><span id="lvb-10"><a href="#" onclick="javascript:showCodeTxt('vb-10'); return false;">view plain</a></span></div>
<div class="shadow">
<div class="syntax_hilite"><span class="langName">Visual Basic:</span>
<div id="vb-10">
<div class="vb">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">Dim</span> strRet <span style="color: #b1b100;">as</span> <span style="color: #b1b100;">String</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">Dim</span> PA <span style="color: #b1b100;">as</span> <span style="color: #b1b100;">Integer</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">Dim</span> strOutStr <span style="color: #b1b100;">as</span> <span style="color: #b1b100;">String</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">PA&nbsp; = <span style="color: #cc66cc;color:#800000;">100</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">strRet = <span style="color: #ff0000;">"abcdef12345"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">strOutStr = GetStrFromVC1 <span style="color:#006600; font-weight:bold;">&#40;</span>PA, strRet <span style="color:#006600; font-weight:bold;">&#41;</span>&nbsp; <span style="color: #808080;">'ByRef ，strRetStr會被改變</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Debug.<span style="color: #b1b100;">Print</span> strOutStr </div>
</li>
</ol>
</div>
</div>
</div>
</div>
<p>
In VC Dll 實作</p>
<div class="igBar"><span id="lcpp-11"><a href="#" onclick="javascript:showCodeTxt('cpp-11'); return false;">view plain</a></span></div>
<div class="shadow">
<div class="syntax_hilite"><span class="langName">C++:</span>
<div id="cpp-11">
<div class="cpp">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">BSTR __stdcall GetStrFroVC1<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">int</span> *PA, BSTR* pbstr<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">char</span> szTemp<span style="color: #000000;">&#91;</span><span style="color: #0000dd;color:#800000;">1024</span><span style="color: #000000;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000dd;">sprintf</span><span style="color: #000000;">&#40;</span>szTemp, <span style="color: #666666;">"*** %s *** "</span>, <span style="color: #000000;">&#40;</span><span style="color: #0000ff;">char</span>*<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#40;</span>*pbstr<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">*PA = SysAllocStringLen<span style="color: #000000;">&#40;</span>pbstr,<span style="color: #000000;">&#40;</span>BSTR<span style="color: #000000;">&#41;</span>szTemp, <span style="color: #0000dd;">strlen</span><span style="color: #000000;">&#40;</span>szTemp<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">return</span> SysAllocString<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>BSTR<span style="color: #000000;">&#41;</span> <span style="color: #666666;">"Test 123456"</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
</div>
<p></p>
<p>例二 : Call By Value<br />
In VB，若function宣告為</p>
<blockquote><p>Private Declare Function GetStrFromVC2 "z:DllDebugDll2.dll" ( ByVal A as integer, ByVal strin as String) As String</p></blockquote>
<p>VB 呼叫 方式不變<br />
In VC Dll 實作</p>
<div class="igBar"><span id="lcpp-12"><a href="#" onclick="javascript:showCodeTxt('cpp-12'); return false;">view plain</a></span></div>
<div class="shadow">
<div class="syntax_hilite"><span class="langName">C++:</span>
<div id="cpp-12">
<div class="cpp">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">BSTR __stdcall GetStrFromVC2<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">int</span> A, <span style="color: #0000ff;">char</span>* strin<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ff0000;">//do something</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
</div>
<p></p>
<dl>
<dt>
<h5>結論 : ByVal 與 ByRef對VC DLL內 function宣告之影響</h5>
</dt>
<dd>(1) ByVal -&gt; char *</p>
</dd>
<dd>(2) ByRef -&gt; BSTR *</dd>
</dl>
<h5>VB How to step into C++ dll ?</h5>
<ol>
<li>開啟VC Dll 專案</li>
<li>設定專案屬性 -&gt; Debug Tab -&gt; Execute for Debug Session -&gt; 選擇 vb6.exe。<br />
Program argument 設為 VB 之專案(.vbp)</li>
<li>VC Dll 專案內設好中斷點，按F5，則會啟動 VB6 IDE 並載入 VB 專案，此時可在VB設中斷點，當執行到呼叫VC function時，可 step into，否則就直接進入VC breakpoint所在行。 <img src="http://i69.photobucket.com/albums/i46/asd98537/dlldebug.png" alt="Debug VC Dll" /></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://evotalk.net/blog/2006/06/vb-pass-string-to-vc-dll.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>將編譯後的dll輸出至專案工作目錄</title>
		<link>http://evotalk.net/blog/2005/12/output-the-dll-to-project-working-directory-after-compiled.html</link>
		<comments>http://evotalk.net/blog/2005/12/output-the-dll-to-project-working-directory-after-compiled.html#comments</comments>
		<pubDate>Wed, 21 Dec 2005 10:52:14 +0000</pubDate>
		<dc:creator>asd</dc:creator>
				<category><![CDATA[科技新知]]></category>
		<category><![CDATA[軟體使用]]></category>
		<category><![CDATA[dll]]></category>

		<guid isPermaLink="false">http://evotalk.net/blog/?p=165</guid>
		<description><![CDATA[之前用 VC 時，若 WorkSpace 包含 Dll 專案，會產出.lib及.dll，.lib通常會設定統一集中在lib目錄下，dll必須與執行檔同個目錄才能執行。所以說必須手動再把 dll 拷貝到主程式 Active Project的工作目錄下，若不只一個Dll專案那就累人了，必須手動逐一copy。其實只要在Dll專案 Setting-&#62;Post build step 新增 command 代表當此專案build完後要作什麼事情，可以下
XCopy ..liblibText2Phone.dll ..gengrm /Y /F /D
/Y /F /D是xcopy的參數，分別表示

/Y: 不要提示您確認是否要覆蓋一個已經存在的檔案
/F: 在複製時顯示來源及目的檔案的全部檔名
/D: 複製在指定日期當天或之後發生變更的檔案。如果沒有給日期， 只複製那些來源檔案日期比目的檔案日期為新的檔案。

]]></description>
			<content:encoded><![CDATA[<p id="fp">之前用 VC 時，若 WorkSpace 包含 Dll 專案，會產出.lib及.dll，.lib通常會設定統一集中在lib目錄下，dll必須與執行檔同個目錄才能執行。所以說必須手動再把 dll 拷貝到主程式 Active Project的工作目錄下，若不只一個Dll專案那就累人了，必須手動逐一copy。其實只要在Dll專案 Setting-&gt;Post build step 新增 command 代表當此專案build完後要作什麼事情，可以下</p>
<blockquote><p><span class="red">XCopy ..liblibText2Phone.dll ..gengrm /Y /F /D</span></p></blockquote>
<p>/Y /F /D是xcopy的參數，分別表示</p>
<ul>
<li>/Y: 不要提示您確認是否要覆蓋一個已經存在的檔案</li>
<li>/F: 在複製時顯示來源及目的檔案的全部檔名</li>
<li>/D: 複製在指定日期當天或之後發生變更的檔案。如果沒有給日期， 只複製那些來源檔案日期比目的檔案日期為新的檔案。</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://evotalk.net/blog/2005/12/output-the-dll-to-project-working-directory-after-compiled.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Calling C++ DLLs from VC++ and VB</title>
		<link>http://evotalk.net/blog/2005/12/calling-c-dlls-from-vc-and-vb.html</link>
		<comments>http://evotalk.net/blog/2005/12/calling-c-dlls-from-vc-and-vb.html#comments</comments>
		<pubDate>Wed, 07 Dec 2005 19:33:20 +0000</pubDate>
		<dc:creator>asd</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Code Snippet]]></category>
		<category><![CDATA[程式設計]]></category>
		<category><![CDATA[dll]]></category>

		<guid isPermaLink="false">http://evotalk.net/blog/?p=147</guid>
		<description><![CDATA[
Calling a DLL C++ function from a VC++ application
Calling a DLL C++ class from a VC++ application
Calling a DLL C++ function from a VB application
Calling a DLL C++ class from a VB application
Loading a C++ DLL dynamically from a VC++ application

]]></description>
			<content:encoded><![CDATA[<ol>
<li><a href="http://www.codeproject.com/dll/XDllPt1.asp">Calling a DLL C++ function from a VC++ application</a><br />
<a href="http://www.codeproject.com/dll/XDllPt1.asp">Calling a DLL C++ class from a VC++ application</a></li>
<li><a href="http://www.codeproject.com/dll/XDllPt2.asp">Calling a DLL C++ function from a VB application</a></li>
<li><a href="http://www.codeproject.com/dll/XDllPt3.asp">Calling a DLL C++ class from a VB application</a></li>
<li><a href="http://www.codeproject.com/dll/XDllPt4.asp">Loading a C++ DLL dynamically from a VC++ application</a></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://evotalk.net/blog/2005/12/calling-c-dlls-from-vc-and-vb.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
