AnsweredAssumed Answered

vrf VEE with .dll's

Question asked by VRFuser on Oct 6, 2003
> Is there a way around this problem, without resorting to returning larger
> int types and breaking them down into bytes?

I'm pretty sure I understood correctly, and the answer is one that I can
think of, but it's a funky one. You want to be able to read "char*" back,
but you want to avoid bytes of 0x00 (obviously - 'zero terminated' as it
were). Add 0x01 to the source bytes. You'll have to give up either 255 or 1
as a valid data point.

YourDll.c:

char* WhateverTheFunctionIs(WhateverTheParametersAre)
{
  WhateverTheCodeIs
  ...
  return (char*)Data;
  // becomes:
  return Convert((char*)Data, CountOfData);
}

inline char* Convert(char* Data, long CountOfData)
{
  for(; CountOfData >= 0; CountOfData--) {
    if(Data[CountOfData] < 255) Data[CountOfData]++;
  }
  return Data;
}

It's pretty wordy but it optimizes down to just over a dozen bytes without
prolog/epilog.
-SHAWN-


---
You are currently subscribed to vrf as: rsb@soco.agilent.com
To subscribe send a blank email to "join-vrf@it.lists.it.agilent.com".
To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".
To send messages to this mailing list,  email "vrf@it.lists.it.agilent.com". 
If you need help with the mailing list send a message to "owner-vrf@it.lists.it.agilent.com".

Outcomes