dllexport for vc 6.0 c++

  • Thread starter Henri.Chinasque
  • Start date
H

Henri.Chinasque

Hi all,

I needed a way to provide vc 6.0 c++ code a way to call managed dlls
compiled in vs 2003. In order to do this I created a wrapper (in vs
2003) for the managed code and made the functions accessible with dll
export.

I then wrote a test application in vc 6.0 which included the .lib file
created from dllexport and called the managed code through it.
Everything works just fine. However, somehow it just seems a little
too good to be true. I'm wondering if I am going to pay for this
approach somewhere down the line.

Does anybody have experience with interoperability between vs6 and vs7
code? Your comments are most welcome.

Thanks,

Henri
 
B

Bruno van Dooren [MVP VC++]

I needed a way to provide vc 6.0 c++ code a way to call managed dlls
compiled in vs 2003. In order to do this I created a wrapper (in vs
2003) for the managed code and made the functions accessible with dll
export.

I then wrote a test application in vc 6.0 which included the .lib file
created from dllexport and called the managed code through it.
Everything works just fine. However, somehow it just seems a little
too good to be true. I'm wondering if I am going to pay for this
approach somewhere down the line.

Does anybody have experience with interoperability between vs6 and vs7
code? Your comments are most welcome.

Hi,

Yes, Life can really be that good. As long as you live by the following
rules, everything is hunky-dory:
- do not deallocate memory that was allocated in another module.
- do not use classes in your public interface. Only plain C functions and
plain old data arguments.
- do not let exceptions escape beyond module boundaries. Use simple return
values.

All praise the power of Visual C++ :)

--

Kind regards,
Bruno van Dooren
(e-mail address removed)
Remove only "_nos_pam"
 
B

Ben Voigt

Bruno van Dooren said:
Hi,

Yes, Life can really be that good. As long as you live by the following
rules, everything is hunky-dory:
- do not deallocate memory that was allocated in another module.
- do not use classes in your public interface. Only plain C functions and
plain old data arguments.
- do not let exceptions escape beyond module boundaries. Use simple return
values.

That advice will work great with VS2005 (vc8). vc7 though may cause random
failures due to things like bugs in the managed c++ runtime library relating
to loader lock, and syntax that lets you pass unpinned managed objects to
native functions.
 

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