Please Help.. "HRESULT: DllNotFoundException"!!
Hi all..
I'm using VS.NET2005.. I created dll from C code.. then I created a C# console application that uses that dll, I locate dll in bin/Debug folder. Then DllImport in C# code. An exception called "HRESULT: DllNotFoundException" was thrown.. I don't know why.. However the dll already exists!
=======
Example of what I made:
------------------------
-C code:
--------
#include"stdio.h"
__declspec(dllexport) void println()
{
printf("I'm println() function!\n");
}
==================================================
-C# code:
---------
using System;
using System.IO;
using System.Runtime.InteropServices;
namespace testexe
{
class Program
{
[DllImport("testdll.dll")]
public static extern void println();
[STAThread]
static void Main(string[] args)
{
Console.WriteLine("I'll call C function Now..\n");
if(File.Exists("testdll.dll"))
{
Console.WriteLine("Dll Exists\n");
}
else
{
Console.WriteLine("Dll Doesn't Exist\n");
}
println();
}
}
}
=======
thnx in advance..
waiting for ur help!
|