[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference decwet::visual

Title:Microsoft Visual C++ bug reports and kits
Notice:Register in Topic 2. 5.Last for latest Kit
Moderator:DECWET::THOMASN
Created:Tue May 17 1994
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:521
Total number of notes:2938

509.0. "Argument mis-alignment calling C++ from bliss" by MERDA::BECASSIDY () Mon May 05 1997 11:22

Hi,

I'm running into a problem which looks to be mis-aligned arguments when calling
a C++ member function from a bliss function.

I have a member function which calls the bliss function with a pointer to
another member function as an argument.  The bliss function then calls the
second member function with a char pointer as an argument.

I can step through all the code and step into the second member function, so
it's seems to be being called OK, but I get a garbage value int the
char * argument.  The address of the string gets loaded into A0 on the stack
and then some other value into A1.  My char * argument gets the value that
is loaded into A1 (the incorrect value).

I'm using VC++ 4.2.  The bliss module was compiled on VAX/VMS V5.5-2H4,
bliss32 V4.7, $ bliss/aw32/noopt/debug

Bill
T.RTitleUserPersonal
Name
DateLines
509.1DECC::OUELLETTEmudseason into blackfly seasonMon May 05 1997 12:3110
Does your callee return a structure by value?
In that case a0 is reserved for a pointer to the storage.
Is the member function not static?
In that case it takes a "this" pointer in a0 and all of
the other arguments get bumped up one slot (including
the struct by value return).
The struct by value thing only gets done for structs
larger than 8 bytes.

R.
509.2MERDA::BECASSIDYMon May 05 1997 13:3510
>>Does your callee return a structure by value?

No, void.

>>Is the member function not static?

The member function is not static.  If it were, the bliss routine wouldn't be
able to call it, right?

Bill
509.3MERDA::BECASSIDYMon May 05 1997 15:0310
>>In that case it takes a "this" pointer in a0 and all of
>>the other arguments get bumped up one slot (including
>>the struct by value return).

Aha!  by casting "this" to a char * I was able to see my string.  Defining
my function as a friend, rather than a member gets me through.

Thanks.

Bill
509.4DECCXL::OUELLETTEmudseason into blackfly seasonMon May 05 1997 15:488
Static member function.  Not static function.

Static member functions are member functions which don't take a this pointer.
They have external linkage.

A friend function is probably what you want & you noticed that in .3.

R.