VC8 GDI+ dll in VC6

A

Asfar

Hi,

Can I write a VC8 dll which used GDI+ and then use this dll in VC6.
I will be using GDI+ to basically load a image in memory and annotate it
with some text and save the image.

Any pointers on how I can do this?

Thanks,
-Asfar
 
C

Carl Daniel [VC++ MVP]

Asfar said:
Hi,

Can I write a VC8 dll which used GDI+ and then use this dll in VC6.
I will be using GDI+ to basically load a image in memory and annotate
it with some text and save the image.

Any pointers on how I can do this?

You can, as long as you expose a pure C (or COM) interface to your VC8 DLL.
If you expose functions that have MFC, ATL or STL types in the interface,
you won't be able to call those functions from VC6. If you expose functions
that have GDI+ types in their interface, it _might_ work, depending on
whether VC6 and VC8 can both compile the exact same version of GDI+ and
whether you have all the options for the two compilers set in a compatible
way.

In your case, if all you want to do is load, annotate and save an image,
your exported function probably needs little more than a path, so it should
be doable.

-cd
 
G

Guest

Can I write a VC8 dll which used GDI+ and then use this dll in VC6.
I will be using GDI+ to basically load a image in memory and annotate it
with some text and save the image.

The functionality itself should not be difficult to figure out.
www.codeproject.com has plenty of GDI+ articles and code samples.

build a class that does what you want to do. after that you can either build
a C style wrapper that exposes the desired functionality of that class, you
can build an activeX control that exports that functionality, or you can
build a managed class library and use it via COM interop.

Should you go for the C style wrapper dll, then you also have to be careful
to respect memory ownership. I.e. do not let the dll allocate memory that
will be deleted by your VC6 app, or vice versa.

--

Kind regards,
Bruno.
(e-mail address removed)
Remove only "_nos_pam"
 
D

Doug Forster

Can I write a VC8 dll which used GDI+ and then use this dll in VC6.

Why do you want to ? GDI+ is an unmanaged library that you could call much
more easily direct from VC6 unmanaged code.

Cheers
Doug Forster
 
C

Carl Daniel [VC++ MVP]

Doug Forster said:
Why do you want to ? GDI+ is an unmanaged library that you could call much
more easily direct from VC6 unmanaged code.

What's that got to do with VC8, which is just as capable of generating
native code as VC6 was?

-cd
 
D

Doug Forster

What's that got to do with VC8, which is just as capable of generating
native code as VC6 was?

Nothing at all. I was presuming the OP had some undisclosed reason for
wanting to work within VC6.
 
D

Doug Forster

Just to continue...

I also supposed the reason the OP wanted to use VC8 for the dll was because
he was under the common misapprehension that GDI+ was a managed library and
that he needed managed code to use it.
 
C

Carl Daniel [VC++ MVP]

Doug said:
Just to continue...

I also supposed the reason the OP wanted to use VC8 for the dll was
because he was under the common misapprehension that GDI+ was a
managed library and that he needed managed code to use it.

Good call :) I'd never heard the misperception that GDI+ was managed, but
apparently it is common!

-cd
 

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