well i'm not using pin_ptr yet, im using this
namespace SknrMV {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System:
ata;
using namespace System:
rawing;
using namespace System::Runtime::InteropServices;
[DllImport("C:\\Dll32mv\\Debug\\Dll32din.dll")]
extern "C" void ConServ(int **);
.....
more code and
private: System::Void button1_Click(System::Object^ sender,
System::EventArgs^ e) {
int *liEstado;
int OtherVal=8;
ConServ(&liEstado); // This is the dll
//OtherVal+= *liEstado;
liEstado=NULL;
}
Hi,
I just tried the following:
VC6 dll:
extern "C"
{
_declspec(dllexport) void _cdecl fun(int** handle);
}
void fun(int** handle)
{
*handle = new int;
**handle = 8;
//yes i know this is a memory leak. it is just an example
}
VC2005 mixed mode WinForms application (/clr):
#pragma unmanaged
extern "C"
{
_declspec(dllimport) void fun(int** handle);
}
#pragma managed
private: System::Void button1_Click(System::Object^ sender,
System::EventArgs^ e)
{
int * ptr;
pin_ptr<int*> pptr = & ptr;
fun(pptr);
MessageBox::Show((*ptr).ToString());
}
added vc6dll.lib as a linker input, then built the app and pressed
button1.
That shows me the messagebox with text '8'. so if you use the pin_ptr it
should work unless the dll is doing something fishy.
I don't see why it should take an int** if all it wants to do is to give
you
an int value. a simple int* would have sufficed for that.
have you checked the documentation for your dll function?
--
Kind regards,
Bruno.
(e-mail address removed)
Remove only "_nos_pam"