> I am trying to use a function within a COM object I wrote 
> in C++ which is expecting two arrays of floats and one 
> variable of type long.
> 
> I noticed in some previous posts that you can only pass 
> strings using CFOBJECT. (Although I did find a Ben Forta 
> article discussing CFOBJECT which seems to claim otherwise:
> http://www.sys-con.com/coldfusion/feature/1-1/bfoncf/index_b.html).

As far as I can tell, you can only pass data to a COM object if that object
can cast it to the correct data from a string. Many COM objects use
datatypes that can be automatically converted from strings. You're going to
have a heck of a time passing arrays, though.

> My function declaration in C is:
> 
>       Corr(float x[1], float y[1], unsigned long n, float *r, 
> float *prob, float
> *z)
> 
> my call to the COM object is:
> 
>       <CFOBJECT TYPE="COM" NAME="Correlation" CLASS="Correlation.Corr"
> ACTION="CREATE">
>       <CFSET Correlation.Corr(#attributes.x#, #attributes.y#, 
> #attributes.n#)>
> 
> my current error is:
> 
>       Arguments expected by object does not match arguments 
> specified in the tag.
>       Error building an argument list for: CORR
> 
> (Which seems to support the assertion that you can only pass 
> Strings). Does anyone know of a work around for passing something 
> other than strings to COM objects? Should I just call the COM 
> object in ASP instead?

If you're not worried about performance issues, you can write a wrapper for
your COM object, which will handle the conversion for you. I've done this
before. I've never done it where the object is expecting an array, though.

Alternatively, you might consider simply rewriting your COM object to accept
the values you can pass from CF. You can add additional interfaces, and
leave the current interface intact, if you are already using your COM object
in other places.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to