Zdravím, mám program v C# Express a z něj chci volat funkce z DLL, která je napsaná v C++ Express jako unmanaged, při běhu hláška
Unable to find an entry point named 'fnlibrary1' in DLL 'D:\cpp\dll\library1\Debug\library1.dll'.
nemohu přijít na způsob, jak v hlavnim programu C# tento bod definovat, také nevím, ja deklarovat volací konvenci, mám řadu příkladů z příruček,
ale žádný nefunguje, něco v nich chybí
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace pokus2
{
public partial class Form1 : Form
{
[DllImport(@"D:\cpp\dll\library1\Debug\library1.dll", EntryPoint = "fnlibrary1")]
public static extern int fnlibrary1();
public Form1()
{
InitializeComponent();
}
private void clik(object sender, EventArgs e)
{
textBox1.Text = fnlibrary1().ToString();
}
}
}
A DLL knihovna
/ dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
// library1.cpp : Defines the exported functions for the DLL application.
//
#include "stdafx.h"
#include "library1.h"
// This is an example of an exported variable
LIBRARY1_API int nlibrary1=0;
// This is an example of an exported function.
LIBRARY1_API int fnlibrary1(void)
{
return 42;
}
// This is the constructor of a class that has been exported.
// see library1.h for the class definition
Clibrary1::Clibrary1()
{
return;
}
#ifdef LIBRARY1_EXPORTS
#define LIBRARY1_API __declspec(dllexport)
#else
#define LIBRARY1_API __declspec(dllimport)
#endif
// This class is exported from the library1.dll
class LIBRARY1_API Clibrary1 {
public:
Clibrary1(void);
// TODO: add your methods here.
};
extern LIBRARY1_API int nlibrary1;
LIBRARY1_API int fnlibrary1(void);
díky za pomoc, už nevím co ještě zkusit