VC++.NET 2003, Managed/Unmanaged code

  • Thread starter Thread starter Bill S.
  • Start date Start date
B

Bill S.

Hi,

I'm trying to create an unmanaged instance within a managed object. In the
one module, I've constructed an unmanaged class that makes a lot of API
calls. It compiles with no errors. In the other module, when an instance of
the unmanaged class is created, a Link error is encountered. (Unresolved
external symbol ...). If comment out the line of code: uc = new
MyUnmanagedClass(), the app builds with no errors. Can anybody help?

Thanks.

//Unmanaged module ///////////////////////////////////////////
using namespace System::Runtime::InteropServices;
#include "stdafx.h"
#include <windows.h>

class MyUnmanagedClass{
//Windows API Stuff.
};

//Managed module /////////////////////////////////////////////
class Form1{
private:
MyUnmanagedClass *uc;

public:
Form1()
{
//A Link error occurs here.
uc = new MyUnmanagedClass();
}
};
 
Bill said:
Hi,

I'm trying to create an unmanaged instance within a managed object. In the
one module, I've constructed an unmanaged class that makes a lot of API
calls. It compiles with no errors. In the other module, when an instance of
the unmanaged class is created, a Link error is encountered. (Unresolved
external symbol ...). If comment out the line of code: uc = new
MyUnmanagedClass(), the app builds with no errors. Can anybody help?

You're missing the source file or library that defines the operation(s)
in MyUnmangedClass that is(are) marked as "Undefined" in the linker
output. Show the full error message if you need more help.

Arnaud
MVP - VC
 
Back
Top