[quoted text, click to view] "0to60" <holeshot60_nospam_@yahoo.com> wrote in message
news:pU9sb.19540$x32.2904@newssvr33.news.prodigy.com...
> I'm trying to create a .dll with VS.NET 2003 Architect that contains a
math
> computational component. I need the guts of the thing to be in native
code,
> as performance is key for that part. But, I need a .net wrapper because
> this "calculator" is actually a component used by an enterprise app
written
> entirely in .net.
>
> What I want to do is have one project. I've created an MC++ .dll project.
> Its got a __gc class (the wrapper) and a handful of __nogc classes. I'm
> having a number of problems with this. First off, as soon as I put a set
a
> pointer to the __nogc class from within my managed wrapper class'
> constructor, the linker complains of unresolved external symbols for
__cdecl
> operator new and delete.
Glibly, I'd suggest that an easier solution would be had by putting the
native code in "free" functions called by the member functions of your
managed classes than by trying to mix managed and non-managed object models.
In that way you can take advantage of the "it just works" (IJW) facility to
have managed and unmanaged functions reside in the same module as long as
you define the boundaries between the two environments with
#pragma managed
and
#pragma unmanaged
Of course, if your project is complex, the more elegant solution may require
proceeding in the way that you outlined. I suggest that you start reading
here for more information on mixed-mode applications:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmex/html/
vcconconvertingmanagedextensionsforcprojectsfrompureintermediatelanguagetomi
xedmode.asp
I used that link to get a mixed-mode project of mine off the ground. I had
the same problem that you did. I defined new and delete operators for my
classes. And because it wasn't necessary for me to squeeze every last ounce
of performance out, I used LocalAlloc() and LocalFree() to implement them.
Regards,
Will