You need to be very specific about name mangling and calling convention
options. On the C++ side, you probably want:
#define FOREXPORT __declspec( dllexport ) __stdcall extern "C"
Use Dependency Walker (
www.dependencywalker.com) to view the export table,
then you have the option of viewing the raw names or the decoded C++ names.
You will probably also want a linker definition file (.def) to avoid name
mangling completely.
If the DLL is a normal Win32 DLL and not a COM/ActiveX DLL, then
you need to DllImport the functions you want to use.
Note that I said functions not classes and methods.
Arne
I tried some like this in cpp dll
#define DllExport __declspec( dllexport )
/DllExport extern void test();
DllExport extern int a();
DllExport extern int b();
/
*****************************************************************************/
void test()
{
}
int a()
{
return 6;
}
int b()
{
return -6; //676k6
}
and in c# code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace ConsoleApplicationTest
{
class Program
{
[DllImport("dng_validate.dll")]
public extern static void test();
[DllImport("dng_validate.dll")]
public extern static int a();
[DllImport("dng_validate.dll")]
public extern static int b();
static void Main(string[] args)
{
test();
b();
a();
}
}
}
but in runtime there is an error that in my dll there is no entry
point test
(also a b tried) There is if i check it with total commander plugin
exported functions are:
int __cdecl a(void)
int __cdecl b(void)
int __cdecl test(void)
?
T I A
JS