Witam!
Napisałem bibliotekę dll w C++ (projekt Wim 32 dll)
Moja biblioteka to:
#include "stdafx.h"
extern "C" _declspec(dllexport) int Dodaj(int b, int b);
void Dodaj(int b, int h)
{
int= a + b;
}
domyślny plik dllmain.cpp bez zmian tzn.
// 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;
}
A plik korzsytający z biblioteki w C# ma postać:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
namespace SharpConsole1
{
class Program
{
[DllImport("MomentOfInertia.dll")]
public static extern int Add(int a, int b);
static void Main(string[] args)
{
int ile=Add(2,3);
}
}
}
W wierszu int ile=Add(2,3);
dostaje błąd
"Nie można odnaleźć określonego modułu. (Wyjątek od HRESULT: 0x8007007E)"
Biblioteka dll jest skopiowana do katalogu z plikiem program.cs
Co to możę być???
Z góry dzięki/
Janusz