C++ Managed and Unmanaged and the New Command

O

Ofer Achler

I'm having horrible, headache inducing problems trying to make a wrapper, or
just a c++ class to interact with a managed class.

I mimiked a managed wrapper to an unmanaged class as showin here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmxspec/html/vcmg_overview.asp

but the compiler gives me a linker error, it will not, under any
circumstance, let me run new on any class that isnt purly .net to begin
with.

Quite painful.

Can anybody give me any clues? im sure its a silly error =)
__gc class MCMythBase

{

public:

MCMythBase() { mMythBase = new CMythBase(); }

~MCMythBase() { delete mMythBase; }

void mPlayShow(long ShowID) { };

private:

CMythBase * mMythBase;

};

fails on creation of CMythBase
MythBase error LNK2001: unresolved external symbol "void * __cdecl operator
new(unsigned int)" (??2@$$FYAPAXI@Z)


also in the C++ managed class i built, it fails on this line in the same way
as above:
mythBase = new MCMythBase();
 
E

Edward Diener

Ofer said:
I'm having horrible, headache inducing problems trying to make a
wrapper, or just a c++ class to interact with a managed class.

I mimiked a managed wrapper to an unmanaged class as showin here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmxspec/html/vcmg_overview.asp

but the compiler gives me a linker error, it will not, under any
circumstance, let me run new on any class that isnt purly .net to
begin with.

Look at the subject, under Managed C++ Extensions in MSDN, of changing a
pure mode DLL to a mixed mode DLL. By default the VS .NET wizards create a
pure mode DLL.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top