Software Archive
Read-only legacy content
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17060 Discussions

Passing Array to COM Object From VB

Intel_C_Intel
Employee
714 Views
I've built a Fortran COM object using the Fortran COM Server Wizard, and I need to be able to pass an array (from VB) in as one of the parameters to a method. What steps do I need to take to accomplish this? I've looked at the examples, but they don't address the COM code. Keep in mind that I'm fairly new to Fortran, and am primarily a VB programmer.
0 Kudos
4 Replies
Intel_C_Intel
Employee
714 Views
Hi,

If I remember correctly, there is nothing special that you need to do on the VB side. When defining the array argument in the Wizard, select "Array argument" and set the appropriate Fortran data type. If the argument is not a "return value", set the Intent to InOut, even if the array is not modified by the server. If the argument is a "return value", select "Return Value" and set the Intent to Out.

Regards,
Leo
0 Kudos
Intel_C_Intel
Employee
714 Views
I tried doing just that, and get an Invalid Type error. This is really frustrating, as the Wizard appears to be fully array aware. Argh!
0 Kudos
Intel_C_Intel
Employee
714 Views
OK, here's wherer I went wrong:
I was testing the DLL from a VBScript file for convenience. When I tested the passing of an array from an actual VB program, it worked fine. I don't know what to do to get it to work from script, but that's not a big deal.

Thanks!!
0 Kudos
Intel_C_Intel
Employee
714 Views
Hi,

VB script passes all items as VARIANTs. This definitely complicates programming of the server. I think this was discussed elsewhere in this forum. Try searching for VARIANT.

Leo
0 Kudos
Reply