Hello,
I'd like to understand how to use dynamic linking library for C665x with CGTv7.4.7. It seems that the main application can call and run the dynamic library, but the library can not access its own global variable. When the library program accesses global variable declared by library, its address is not the main application but the library. The library address is dummy. I want to have the library program access the main application address.
That's the library program below. Please give me advices.
-------
__declspec(dllexport) int add_array(int d[], int size); __declspec(dllexport) int arrayDataGbl[]; #pragma DATA_SECTION(arrayDataGbl,".startData") int arrayDataGbl[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; int add_func( int d[],int size ) { int i, temp=0; for(i=0; i<size; i++){ temp += d[i]; } return temp; } #pragma CODE_SECTION(add_array,".startFunc") int add_array(int arrayData[]/* not used */, int arraysize) { int temp; temp = add_func(arrayDataGbl, arraysize); return temp; }
-------
Regards,
Kazu