Managed Code in Unmanaged C++
Posted: Sat Jan 05, 2008 12:27 am
I followed Microsofts instructions, but when I compile my un-managed C++ project and it imports my type library it find a **** load of errors and it fails to build. Has anyone ever done this before that can help me?
The error's are like this:
Instructions for it can be found here:
http://support.microsoft.com/kb/828736
Here's my code I'm compiling into a type library:
The error's are like this:
Code: Select all
IO.tlb stray '\255' in program
http://support.microsoft.com/kb/828736
Here's my code I'm compiling into a type library:
Code: Select all
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace IO
{
public class ReaderWriter : IReaderWriter
{
public int GetInt32(string path, int offset)
{
BinaryReader br = new BinaryReader(new FileStream(path, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite));
if ((br.BaseStream.Length - 4) >= offset)
{
br.BaseStream.Position = offset;
int ret = br.ReadInt32();
br.Close();
return ret;
}
return -1;
}
};
public interface IReaderWriter
{
int GetInt32(string path, int offset);
};
}