473,322 Members | 1,538 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Unmanaged and Managed C++

Hi, this is the example code I ma trying to execute....

SIPX_INST tInst;
SIPX_LINE tLine;
SIPX_CALL tCall, tempCall;

void phone::registerButton_Click(System::Object^ sender, System::EventArgs^ e)
{
registerExt();
}

void phone::registerExt()
{
temp1 = extTextBox->Text;
temp2 = proxyTextBox->Text;

temp1= temp1 + "@" + temp2;

regExt = (char*)System::Runtime::InteropServices::Marshal:: StringToHGlobalAnsi(temp1).ToPointer();

if(SIPX_RESULT_SUCCESS != sipxInitialize(&tInst,
DEFAULT_UDP_PORT,
DEFAULT_TCP_PORT,
DEFAULT_TLS_PORT,
DEFAULT_RTP_START_PORT,
DEFAULT_CONNECTIONS,
regExt,
NULL,
true))
{
eventTextBox->Text = "Initialize Fail!!!";
}
else
eventTextBox->Text = "Initialize Success!!!";


if(SIPX_RESULT_SUCCESS != sipxLineAdd(tInst, regExt, &tLine))
eventTextBox->Text = "Line Add Fail!!!";
else
eventTextBox->Text->Concat("Line Add Success!!!");

if(SIPX_RESULT_SUCCESS != sipxLineRegister(tLine, true))
{
MessageBox::Show("Error Registering !!!", "Registration Notification");
eventTextBox->Text = "Register Error!!!";
}
else
{
MessageBox::Show("Registration Success !!!", "Registration Notification");
eventTextBox->Text = "Registered Successfully !!!";
EventListener(tInst);
}
}



Now, let me explain the code above.

I am using and unmanaged C code. i.e, a .lib, .dll and .h file that is written in unmanaged C. I am trying to use these with a managed C++ windows forms application.

The problem that I seem to be facing is that, when I declare the variable SIPX_INST tInst, withing the register(), I am able to "Watch" the value for the tInst variable during debugging.

But when its declared as in the code above, the "Watch" says, error:identifier 'tInst' out of scope. And also I am not able to pass the value to the eventListener() and use it any further in the program, even though the variable is declared as global.

can anyone help? Thank You in advance!!!!
Sep 20 '06 #1
4 1454
radcaesar
759 Expert 512MB
Where u declared that SIPX_INST tInst;
Next to class declaration ??

If so, check the scope of that variable inside any private message. If its shown there, then no problem.
Sep 20 '06 #2
Where u declared that SIPX_INST tInst;
Next to class declaration ??

If so, check the scope of that variable inside any private message. If its shown there, then no problem.

SIPX_INST is of type void * which is typedef'd in a .h file which is an unmanaged C code.
Sep 20 '06 #3
radcaesar
759 Expert 512MB
Have a look on this thread,

http://msdn.microsoft.com/msdnmag/issues/02/08/CQA/

If you make exact compiler optins when compile and after add the reference by "using" key word, then you are able to access all the members.
Sep 20 '06 #4
Have a look on this thread,

http://msdn.microsoft.com/msdnmag/issues/02/08/CQA/

If you make exact compiler optins when compile and after add the reference by "using" key word, then you are able to access all the members.
Thanks for your help!!!

However I dont seem to figure out a way to implement whats in the article to my use.....
Sep 20 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Bob Rock | last post by:
Hello, in the last few days I've made my first few attempts at creating mixed C++ managed-unmanaged assemblies and looking aftwerwards with ILDASM at what is visible in those assemblies from a...
5
by: Chris Kiechel | last post by:
I am writing a .NET Windows application and it needs to perform DDE calls to a legacy system. I created a C++ unmanaged class that performs the actual DDE connection and communication. However,...
2
by: joye | last post by:
Hello, My question is how to use C# to call the existing libraries containing unmanaged C++ classes directly, but not use C# or managed C++ wrappers unmanaged C++ classes? Does anyone know how...
4
by: Rachel Suddeth | last post by:
What is the difference between a managed/unmanaged resource, and how do you tell which is which? I'm trying to understand how to write some Dispose() methods, and we are supposed to put code that...
2
by: Bob Rock | last post by:
Hello, in the last few days I've made my first few attempts at creating mixed C++ managed-unmanaged assemblies and looking afterwards with ILDASM at what is visible in those assemblies from a...
3
by: zhphust | last post by:
I want to convert a object of a managed class to a unmanaged structure that has the same member with that managed class. Can anybody tell me how i can do it? Thanks in advance. -- zhphust...
1
by: Sparhawk | last post by:
Hi, my company is going to migrate a large VC++ application to .NET to make use of Windows Forms (the old class library is not updated any more). We are not planning to migrate the rest of the...
6
by: Stephen Walch | last post by:
Our application environment consists of three basic layers: 1. Third-party unmanaged DLLs that were written before the CLR was invented and maintain a significant amount of information (including...
9
by: Amit Dedhia | last post by:
Hi All I have a VC++ 2005 MFC application with all classes defined as unmanaged classes. I want to write my application data in xml format. Since ADO.NET has buit in functions available for...
2
by: Jon Slaughter | last post by:
How difficult is it for one to integrate unmanaged C++ into C#? I know for functions one can use DLLimport but how does one go about doing it for classes? Do I have to completely reimplement the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.