Progress and .Net DLL's using COM Objects

tonydt1g3r

New Member
First off I am using Progress 10.0A, and I am recieving this error message.

Error occured while accessing component property/method: density. The type initializer for "QuantifiPINVOKE" threw an exception.
Error code: 0x80020009 C:\Quantifi\Progress\p53439_test.ped (5890)

Ok let me try to explain what I am trying to do. The company I am working for is trying to use a pricing tool called Quantifi. This Quantifi software contains a bunch of functions in a .net DLL file. Since Progress cant comunicate with .net directly, they(progress) suggested that I use com object to have them communicate. Thus I wrote a wrapper in C# to communicate with progress. First I wrote a simple function like 1 + 1 just to make sure that my wrapper was working correctly and I could pass variables to and from progress to the wrapper. But when I call my second function that references the Quantifi.dll which this wrapper was written for it doesnt seem to work. I called progress but they are of no help and i am completely stumped. I tested these two functions in Excel VBA just to make sure that the Quantifi stuff was indeed working and it works fine from excel, so I dont understand why it wouldnt be working from Progress. I have pasted my error prone code below.


Progress Code:
DEF VAR ATS_CALL_NET AS COM-HANDLE NO-UNDO.

DEF VAR int_date AS DECIMAL.

CREATE "COMExample.CDSPricer" ATS_CALL_NET.


/*int_date = ATS_CALL_NET:pv(1.0).*/

INT_date = ATS_CALL_NET:density (
1.0,
2.0,
3.0).

MESSAGE int_date.

RELEASE OBJECT ATS_CALL_NET.




C# Code:

using System;
using System.Runtime.InteropServices;
using Quantifi;
using Quantifi.Numerics;

namespace COMExample
{
// NOTE: COM GUID's generated using guidgen

// Interface
[Guid("556B4386-CC60-414B-9D3C-378FE0900A1B")]
public interface ICDSPricer
{
[DispId(1)]
double Pv(double premium);

[DispId(2)]
double density(double x, double a, double b);
}

// COM CoClass
[Guid("061861B9-E0B9-4CA8-9408-47BEE3BB08A4")]
public class CDSPricer : ICDSPricer
{

public double Pv(double premium)
{
double abc;

abc = premium + 2;
return abc;
}

public double density(double x, double a, double b)
{

double answer;
//x = 1;
//a = 2;
//b = 3;

answer = Quantifi.Numerics.Beta.density(x,a,b);
//answer = Quantifi.Numerics.Beta.cumulative(.5,2,3);
return answer;
}
}
}


Any help would be greatly apreciated.

-Tony
 
Back
Top