<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<head><meta forua="true" http-equiv="Cache-Control" content="max-age=0" /></head>
<card title="编写C++非托管DLL以及在.NET托管中调用" id="card1">
<p> 游客</p><p>
标题:编写C++非托管DLL以及在.NET托管中调用<br/>
正文:<br/>
<br/><br/>编写C++非托管DLL以及在.NET托管中调用 新建项目，来到Win32，点击Win32项目输入名称MyVC点击确定。应用程序类型，勾选DLL，点击完成。  MyVC.cpp #include &quot;stdafx.h&quot;#include &amp;lt;stdio.h&amp;gt; extern &quot;C&quot; __declspec(dllexport) int Max(int a,int b){         return a&amp;gt;b?a:b;}extern &quot;C&quot; __declspec(dllexport) int Min(int a,int b){         return a&amp;gt;b?b:a;} //此示例来自CSDNextern &quot;C&quot; __declspec(dllexport) void GetName(char* buffer, int* size){    printf(&quot;before copy the length is:%d\n&quot;, *size);//写数据前buffer的容量    char temp[] = &quot;hello,world&quot;;    strcpy(buffer,temp); //模拟写数据    printf(&quot;OK, string is:%s\n&quot;, buffer);    *size = (int)strlen(temp);    printf(&quot;after copy the length is:%d\n&quot;, *size<br/><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=324&amp;Page=1">[&lt;&lt;]</a><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=324&amp;Page=1">[[1]]</a><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=324&amp;Page=2">[2]</a><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=324&amp;Page=3">[3]</a><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=324&amp;Page=4">[&gt;&gt;]</a><br/>
<br/>
<a href="wap.asp?act=Com&amp;id=324">查看评论(0)</a><br/>
<a href="wap.asp?act=AddCom&amp;inpId=324">发表评论</a><br/><br/>

<br/>

<br/>
<a href="http://camnpr.com/wap.asp">首页</a>
</p>
</card>
</wml>