OT: Can VS 2005 dll be used by Mingw?

P

pkirk25

Sorry if this is off topic but I'm not sure where to post it. 2 of us
are working on a small project - me doing the dll and him doing the
GUI. I have Visual Studio 2005 and he is using mingw.

Is it possible for him to use my dlls or should we simply send source
files to on another?

Thanks in advance.
 
M

Mathias Gaunard

pkirk25 said:
Is it possible for him to use my dlls or should we simply send source
files to on another?

Of course.
DLLs can be used from any compiler.
 
O

Ondra Holub

pkirk25 napsal:
Sorry if this is off topic but I'm not sure where to post it. 2 of us
are working on a small project - me doing the dll and him doing the
GUI. I have Visual Studio 2005 and he is using mingw.

Is it possible for him to use my dlls or should we simply send source
files to on another?

Hi. In general it is possible. But there may be some issues.

1. You have no problem when DLL has C interface
2. If you have DLL with C++ interface, all exported symbols will be
mangled, because C++ uses funcion overloading, so it must somehow
distinguish among overloaded function names. The way, how are symbols
named (mangled) is compiler specific.So for example DLL made in Gnu C++
exports symbols in different way than Visual Studio C++ compiler.

Sometimes you may be lucky and it could seem, that you are able to use
the DLL made in other compiler. But there may be big problem too.
Imagine you have following function in your DLL interface:

void Function(std::string& text);

Now imagine, that every compiler implements the standard library in
different way (although interface is (more or less) same). So you can
call such function placed in DLL made in compiler A, but you will pass
to it instance of std::string made in compiler B. It may have
completely different structure and it may cause "magic things" to
happen.

I wouldn't recommend to combine C++ DLL with code compiled in other
compiler and if you can, exchange sources with your partner.
 
R

Renee Klawitter

pkirk25 said:
Sorry if this is off topic but I'm not sure where to post it. 2 of us
are working on a small project - me doing the dll and him doing the
GUI. I have Visual Studio 2005 and he is using mingw.

Is it possible for him to use my dlls or should we simply send source
files to on another?

You won't have any luck exchanging DLLs, unless you use COM or something
alike. C++ supports *syntactical* encapsulation, but not binary
encapsulation. Meaning that although you both use the same C++ interface,
what your respective compilers do with them is incompatible - thus your
linker, which is used to VC8 binaries will not be able to handle his
DLL.

It's better to exchange source code - or even better to have the same
development tool. I do not know mingw but I know VC6 to VC8(2005) and
it is hard to use in VC6 a DLL written in VC7. One has to wrap one's
Interface in a C API to get them to work together. That would be a
possible solution for you too, but it is cumbersome.

/Renee.
 
K

kwikius

Renee said:
You won't have any luck exchanging DLLs, unless you use COM or something
alike. C++ supports *syntactical* encapsulation, but not binary
encapsulation. Meaning that although you both use the same C++ interface,
what your respective compilers do with them is incompatible - thus your
linker, which is used to VC8 binaries will not be able to handle his
DLL.

It's better to exchange source code - or even better to have the same
development tool. I do not know mingw but I know VC6 to VC8(2005) and
it is hard to use in VC6 a DLL written in VC7. One has to wrap one's
Interface in a C API to get them to work together. That would be a
possible solution for you too, but it is cumbersome.

You have to use the correct interface but it is perfectly feasible to
mix DLLs from different compilers AFAIK. within a particular platform
See here:

http://www.mingw.org/mingwfaq.shtml#faq-msvcdll

regards
Andy Little
 
K

kwikius

Renee said:
What they do is exporting a C-API, not C++. You have to use COM or one
of its descendents to export a C++-API.

Sure. Yes. I guess it is worth pointing that out!

regards
Andy Little
 

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

Members online

No members online now.

Forum statistics

Threads
474,436
Messages
2,571,696
Members
48,796
Latest member
Greg L.
Top