Progress Error when calling C# Wrapper using COM objects



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

--
Posted using the http://www.dbforumz.com interface, at author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbforumz.com/Progress-Error-calling-Wrapper-objects-ftopict255488.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbforumz.com/eform.php?p=881778
.



Relevant Pages

  • Re: Progress Error when calling C# Wrapper using COM objects
    ... but can you pass double precision decimals to/from Progress?. ... > Quantifi software contains a bunch of functions in a .net DLL file. ... > wrote a wrapper in C# to communicate with progress. ... > public interface ICDSPricer ...
    (comp.databases.progress)
  • How do you do asynchronous processing in C#
    ... I'm trying to implement asynchronous call to COM interface below and having trouble understanding what C# code will allow me to update progress bar while call is running. ... I have an object called MyDownloader which has a method of BeginDownload below, I need to periodically update main program about progress and when call is completed to return back to processing. ... An IDownloadProgressChangedCallback interface that is called periodically for download progress changes before completion. ...
    (microsoft.public.dotnet.languages.csharp)
  • CDialog from CWinThread derived class hangs on ShowWindow(SH_HIDE) on shutdown
    ... I've got a CDialog derived class that is wrapped inside of a ... thread-safe wrapper that displays a progress dialog. ... takes a long time could continue in the parent thread. ... ExitInstance method trys to invoke a method in the wrapper class to ...
    (microsoft.public.vc.mfc)
  • Re: How do I pinvoke this function?
    ... interface is always going to be populated with the entries for the methods ... in IUnknown in the first three slots, follwed by the methods for the ... possibly be a COM interface pointer. ... And the best you could do with the progress pointer is pass it ...
    (microsoft.public.dotnet.languages.csharp)
  • Rechenintensiver Workthread mit Progressbar (Umsetzung von C#/VB nach VC++)
    ... System.Threading.WaitCallback, progress) ... Private Sub bearbeitung ... Public Interface IProgressCallback ...
    (microsoft.public.de.vc)