Click to See Complete Forum and Search --> : Passing __gc[] into a function help!!


mchow2469
July 11th, 2005, 06:55 PM
Hi,

I currently need to pass an array "float __gc[]" into a built in function which takes in an array of type void*.

The compiler isn't liking it and complains:
testWave.h(113): error C2664: 'FileToArray' : cannot convert parameter 2 from 'float __gc[]' to 'void *'

Do you guys know a way to get managed and unmanged code to agree?
Thanks!

NoHero
July 12th, 2005, 06:20 AM
Passing a managed pointer to an unmanaged is not possible. You need to convert your managed array of floats back to an unmanaged array of floats first, before passing it to the unmanaged function.

mchow2469
July 12th, 2005, 11:16 AM
Ok Thanks!

How would I convert the __gc[] array to a regular array without the garbage collector?

NoHero
July 12th, 2005, 12:04 PM
Simply create an array with equal size just for the unmanaged counterpart and copy value for value into the unmanaged. Notice: use __nogc new to allocate an unmanaged peace of memory. And be sure to delete it after it has been used.