我需要创建一个可以从PowerBuilder 12.5调用的dll。我在https://sites.google.com/site/robertgiesecke/Home/uploads#TOC-Samples找到了RGiesecke.DllExport页面。我创建了以下非常简单的c#项目作为控制台应用程序,在向导中我选择了dll:
VS2013 framework 3.5
Windows 7
using System;
using System.Collections.Generic;
using System.Text;
using RGiesecke.DllExport;
using System.Runtime.InteropServices;
namespace PRS
{
internal static class UnmanagedExports
{
[DllExport("getsmoochie", CallingConvention = CallingConvention.StdCall)]
static string GetSmoochie()
{
return "Success";
}
}
}
我在发布模式下编译为32位,然后尝试使用以下命令从PowerBuilder访问dll:
Function string GetSmoochie() library "PRS.dll"
我回来看起来像汉字。
另外我发现有一件事有点奇怪:如果我尝试用Regsvr32注册dll,我得到并且错误告诉我没有dll入口点。我不知道该怎么想。
我对PowerBuilder有额外的dll需求,但我似乎无法使用最简单的东西。任何帮助将不胜感激。
谢谢。
更新:
在我看来,在这种情况下获取一个受损的字符串可能不是问题,因为我真正需要执行的代码将文件发送到Web服务,所以我实现了SendFile()代码,它可以从PowerBuilder运行。
我从上面的代码中做的一个改变是添加关键字" public"方法调用。
求和:RGiesecke dll导出模板有效!
更新: 请参阅下面的说明。这是我传入的文件名:
[DllExport("sendfile", CallingConvention = CallingConvention.StdCall)]
public static long SendFile(String filename)
由于具有文件名硬编码的代码可以工作,我必须假设文件名在某种程度上受到损坏,并且dll无法完成它。
有什么想法吗?
答案 0 :(得分:1)
你也必须整理你的回报值。这段代码适合我:
<tbody>
{% for item in items %}
<tr>
<form action="{% url 'newitem' %}" role="form" method="post">
{% csrf_token %}
<th> {{ item.id }} <input type="hidden" name="item_id" value="{{ item.id }}" > </th>
<td> {{ item.Name }} </td>
<td>
{% buttons %}
<input type="submit" name="action" value="Delete" class="btn btn-danger btn-xs" style="width: 50px" />
{% endbuttons %}
</td>
</form>
</tr>
{% endfor %}
</tbody>
PB 11.5 Classic
目标框架.NET 4.5.2
平台目标x86