第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

C#調(diào)用C++編寫的DLL報(bào)錯(cuò)

C#調(diào)用C++編寫的DLL報(bào)錯(cuò)

Qyouu 2018-12-06 18:03:58
無(wú)法在 DLL“D:\jk\DynamicLibrary\Debug\MathFuncsDll”中找到名為“helloworld”的入口點(diǎn)。? 說(shuō)明: 執(zhí)行當(dāng)前 Web 請(qǐng)求期間,出現(xiàn)未經(jīng)處理的異常。請(qǐng)檢查堆棧跟蹤信息,以了解有關(guān)該錯(cuò)誤以及代碼中導(dǎo)致錯(cuò)誤的出處的詳細(xì)信息。? 異常詳細(xì)信息: System.EntryPointNotFoundException: 無(wú)法在 DLL“D:\jk\DynamicLibrary\Debug\MathFuncsDll”中找到名為“helloworld”的入口點(diǎn)。源錯(cuò)誤:? 行 17: protected void Page_Load(object sender, EventArgs e)行 18: {行 19: string s = helloworld();行 20: Response.Write("<script>alert('"+s+"')</script>");行 21: }報(bào)的上面得錯(cuò)誤我的代碼如下:首先在.h文件里寫如下代碼定義方法:// MathFuncsDll.h#include <string>? namespace MathFuncs{? class MyMathFuncs? {? public:static __declspec(dllexport) std::string helloworld();? // Returns a + b? static __declspec(dllexport) double Add(double a, double b);? // Returns a - b? static __declspec(dllexport) double Subtract(double a, double b);? // Returns a * b? static __declspec(dllexport) double Multiply(double a, double b);? // Returns a / b? // Throws DivideByZeroException if b is 0? static __declspec(dllexport) double Divide(double a, double b);? };}在.cpp文件里寫如下代碼實(shí)現(xiàn)方法:// MathFuncsDll.cpp#include "MathFuncsDll.h"#include <stdexcept>#include <string>using namespace std;namespace MathFuncs{std::string MyMathFuncs::helloworld(){return "helloworld";}? double MyMathFuncs::Add(double a, double b)? {? return a + b;? }? double MyMathFuncs::Subtract(double a, double b)? {? return a - b;? }? double MyMathFuncs::Multiply(double a, double b)? {? return a * b;? }? double MyMathFuncs::Divide(double a, double b)? {? if (b == 0)? {? throw new invalid_argument("b cannot be zero!");? }? return a / b;? }}然后在web頁(yè)面里寫下面的代碼調(diào)用:using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Runtime.InteropServices;namespace MyWebDll{? public partial class _Default : System.Web.UI.Page? {? [DllImport(@"D:\jk\DynamicLibrary\Debug\MathFuncsDll")]? public static extern string helloworld();? protected void Page_Load(object sender, EventArgs e)? {? string s = helloworld();? Response.Write("<script>alert('"+s+"')</script>");? }? }}然后就報(bào)上面的錯(cuò)誤。請(qǐng)高手指點(diǎn)。謝謝!沒(méi)寫過(guò)c++的,第一次用,有些東西表達(dá)不清楚還請(qǐng)見諒,謝謝啦!
查看完整描述

3 回答

?
眼眸繁星

TA貢獻(xiàn)1873條經(jīng)驗(yàn) 獲得超9個(gè)贊

添加一個(gè)def文件,在里將helloworld 公布出來(lái)

例:

helloworld @ 1

查看完整回答
反對(duì) 回復(fù) 2019-01-21
?
翻閱古今

TA貢獻(xiàn)1780條經(jīng)驗(yàn) 獲得超5個(gè)贊

你可以搜下怎么把一個(gè)類作為接口。depends這個(gè)你可以看下你封裝的DLL是否有問(wèn)題。

查看完整回答
反對(duì) 回復(fù) 2019-01-21
  • 3 回答
  • 0 關(guān)注
  • 478 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)