Code: Select all
template <class T>
T *memcpy(T *dest, T *src, int count)
{
int i;
for(i=0; i < count; i++)
{
*dest = *src;
}
return dest;
}
P.S. I am aware of name mangling.
Code: Select all
template <class T>
T *memcpy(T *dest, T *src, int count)
{
int i;
for(i=0; i < count; i++)
{
*dest = *src;
}
return dest;
}
I figured that would be the best way. If I fo it all through g++, the name mangling problem takes care of itself. I just have to be careful that I make any function that would be called in my assembly code is linked in c-style.gerryg400 wrote:The best way, in my opinion is to write your 'c' in a cpp file and compile it with g++. Then it all just works.
Code: Select all
extern "C" void print (string x)
{
std::cout << x << std::endl;
return;
}