Advertisement

02.26.2008 at 07:42AM PST, ID: 23193829
[x]
Attachment Details

Required finally block support in unmanaged VC++ code

Asked by gaurav1408 in Microsoft Visual C++.Net, C / C++ / C# Editors and IDEs, Microsoft Visual C++

Tags: ,

I have an unmanaged VC++ code written in visual studio 8 serving Excel Add-In. The project has NO CLR support. Now there is an requirement of adding a finally block in this code.  If I add __finally block in this code and add CLR supprt to "Common Language Runtime Support, Old Syntax (/clr:oldSyntax)" in project Configuration -> General Properties, the DLL looses COM support and can NO longer be consumed by my Excel Add-In
I have tried tlbexp D:\marketAxess\release\MktxAddin.dll /out:MktxAddin.dll to get COM dll but this does not work as well.
Please help. Attached is the sample code.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
VC++ code
long __declspec (dllexport) __stdcall MktxInqUpload(structInquiry *pMktxInq, structError *objError){
	try{
            ....
	}
	catch (exception e)
	{
	  ...
	  return 0;	 		
	}
    catch (...)
    {	   
	   ...
	   return 0;		 
    }
	__finally
	{
		WriteLog("reached","reached");
	}
 
}
 
VBA Code 
Declare Function MktxInqUpload Lib "c:\MktxAddin.dll" (ByVal tUploadMktxInq As Long, ByVal tError As Long) As Long
 
lResult = MktxInqUpload(VarPtr(objMktxInquiry), VarPtr(objError))
[+][-]02.29.2008 at 04:31PM PST, ID: 21018936

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft Visual C++.Net, C / C++ / C# Editors and IDEs, Microsoft Visual C++
Tags: Microsoft, VC++
Sign Up Now!
Solution Provided By: evilrix
Participating Experts: 1
Solution Grade: A
 
 
[+][-]05.22.2008 at 02:52AM PDT, ID: 21622283

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]05.26.2008 at 05:22AM PDT, ID: 21645993

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]05.26.2008 at 05:31AM PDT, ID: 21646055

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628