| View previous topic :: View next topic |
| Author |
Message |
Olivier Bertini Guest
|
Posted: Thu Mar 23, 2006 7:03 pm Post subject: VC++8 |
|
|
Hello,
I already posted this question to the ms-compatibility newsgroup but got
no answer.
How to use a VC++8 c dll with BCB6 (or BDS2006 demo). The problem is
that when I try to dynamically load the dll (Loadlibrary) I get the
error message:
-->
Runtime error!
Program: MyPath\MyApp.exe
R6034
An application has made an attempt to load the C runtime library
incorrectly. Please contact the application's support team for more
information.
<--
This seems to be related to a manifest file that must be embedded in the
dll. I checked and the manifest is actually embedded in it. I suppose I
must do something like embedding this manifest into my application
(BCB6) too, but I don't know how.
Is this the correct approach? If yes, how to do it?
Regards,
Olivier |
|
| Back to top |
|
 |
Clayton Arends Guest
|
Posted: Fri Mar 24, 2006 7:03 am Post subject: Re: VC++8 |
|
|
I haven't seen that particular error before. What is your code?
- Clayton |
|
| Back to top |
|
 |
Olivier Bertini Guest
|
Posted: Fri Mar 24, 2006 4:03 pm Post subject: Re: VC++8 |
|
|
Clayton Arends a écrit :
| Quote: | I haven't seen that particular error before. What is your code?
|
This has nothing to do with my code. I suggest you have a look at
http://www.codeproject.com/cpp/vcredists_x86.asp#Introduction if you
intend to work with VC++8.
Sadly the information on this site didn't work for me. I suppose this is
because the app which call the dll must also have the manifest stuff.
Olivier |
|
| Back to top |
|
 |
Andre Kaufmann Guest
|
Posted: Fri Mar 24, 2006 5:03 pm Post subject: Re: VC++8 |
|
|
Olivier Bertini wrote:
| Quote: | Clayton Arends a écrit :
I haven't seen that particular error before. What is your code?
This has nothing to do with my code. I suggest you have a look at
http://www.codeproject.com/cpp/vcredists_x86.asp#Introduction if you
intend to work with VC++8.
Sadly the information on this site didn't work for me. I suppose this is
because the app which call the dll must also have the manifest stuff.
Olivier
|
Try to compile using the static runtime library.
Project Settings - C/C++ - Code Generation - Runtime Library:
Then instead "Multi-threaded DLL (/MD)" select
"Multi-threaded (/MT)"
Then you shouldn't be depended on the dynamic runtime library and
therefore should not need a manifest file for a plain DLL, which doesn't
use COM and COM isolation.
You could also additionally try to disable the manifest file in the
linker settings.
Hope this helps.
Andre |
|
| Back to top |
|
 |
Andre Kaufmann Guest
|
Posted: Fri Mar 24, 2006 5:03 pm Post subject: Re: VC++8 |
|
|
Andre Kaufmann wrote:
| Quote: | Olivier Bertini wrote:
Clayton Arends a écrit :
I haven't seen that particular error before. What is your code?
This has nothing to do with my code. I suggest you have a look at
http://www.codeproject.com/cpp/vcredists_x86.asp#Introduction if you
intend to work with VC++8.
Sadly the information on this site didn't work for me. I suppose this
is because the app which call the dll must also have the manifest stuff.
Olivier
Try to compile using the static runtime library.
Project Settings - C/C++ - Code Generation - Runtime Library:
Then instead "Multi-threaded DLL (/MD)" select
"Multi-threaded (/MT)"
Then you shouldn't be depended on the dynamic runtime library and
therefore should not need a manifest file for a plain DLL, which doesn't
use COM and COM isolation.
You could also additionally try to disable the manifest file in the
linker settings.
Hope this helps.
Andre
|
This applies to the VC compiler settings only.
It's not the fault of BDS and you cannot correct this behavior by
adjusting some project settings in BDS.
If you have not access to the VC sources and cannot rebuilt the DLL and
are still have problems to load the DLL even if you have the .NET 2.0
runtime installed (should come with all required DLL's) or with the VC
Runtime Library package installed then I think the project of the DLL
has been
a) Either built with a beta version
b) Is misconfigured
c) Depends on additional libraries (DLL's), configured in the
manifest file.
Andre |
|
| Back to top |
|
 |
Olivier Bertini Guest
|
Posted: Fri Mar 24, 2006 7:03 pm Post subject: Re: VC++8 |
|
|
Andre Kaufmann a écrit :
| Quote: | This applies to the VC compiler settings only.
It's not the fault of BDS and you cannot correct this behavior by
adjusting some project settings in BDS.
|
Of course it is not BDS's fault. It's MS new way of distributing dll.
| Quote: |
If you have not access to the VC sources and cannot rebuilt the DLL and
are still have problems to load the DLL even if you have the .NET 2.0
runtime installed (should come with all required DLL's) or with the VC
Runtime Library package installed then I think the project of the DLL
has been
a) Either built with a beta version
|
Visual Studio C++ 2005 Express fresh download from Microsoft website.
| Quote: | c) Depends on additional libraries (DLL's), configured in the
manifest file.
|
The dll in question is a plug-in for a BCB app. It uses BOOST 1.33.1 and
a library for serving web pages. Both BOOST and the library have been
compiled with VC++8 Express. Demo and sample run just fine.
Some strange behavior:
I extracted the embedded manifest from the myplugin.dll with ResHacker
to a .res file. Then I added it to the BCB project and compiled. The
program could not start because of an error in initialization. So I
removed the res file and recompiled. Then it ran and loaded the
plugin.dll properly!! But as soon as I change plugin.dll in VC it starts
again to complain. Moreover when debugging the dll from VC, it doesn't
load and say nothing?!
Thanks for your help,
Olivier |
|
| Back to top |
|
 |
Olivier Bertini Guest
|
Posted: Fri Mar 24, 2006 7:03 pm Post subject: Re: VC++8 |
|
|
Andre Kaufmann a écrit :
| Quote: | Try to compile using the static runtime library.
Project Settings - C/C++ - Code Generation - Runtime Library:
Then instead "Multi-threaded DLL (/MD)" select
"Multi-threaded (/MT)"
|
I already tried this approach. Unfortunately I get some error messages like
msvcrtd.lib(MSVCR80D.dll) : error LNK2005: _malloc already defined in
LIBCMT.lib(malloc.obj).
If I put msvcrtd.lib in the Ignore Specific library I get more errors
If I put LIBCMT.lib in the Ignore Specific library it compiles fine but
then still throw the error that CRT was not properly initialized.
Olivier |
|
| Back to top |
|
 |
Olivier Bertini Guest
|
Posted: Sat Mar 25, 2006 6:03 pm Post subject: Re: VC++8 |
|
|
I found the problem to come from a library that was compiled with VC++8
but from the command line. It appears that the generated dlls did not
contained the manifest resource. However the manifest file was generated
as a separate file.
The solution is to embed it using the command:
mt /manifest lib.dll.manifest /outputresource:lib.dll;#2
Thanks to all of you who regularly help people. Your help is very
appreciated.
Olivier Bertini |
|
| Back to top |
|
 |
Hendrik Schober Guest
|
Posted: Mon Mar 27, 2006 4:03 pm Post subject: Re: VC++8 |
|
|
Olivier Bertini <olivier.bertini (AT) NOOSPAAAAMMMMMurbanet (DOT) ch> wrote:
| Quote: | Andre Kaufmann a écrit :
Try to compile using the static runtime library.
Project Settings - C/C++ - Code Generation - Runtime Library:
Then instead "Multi-threaded DLL (/MD)" select
"Multi-threaded (/MT)"
I already tried this approach. Unfortunately I get some error messages like
msvcrtd.lib(MSVCR80D.dll) : error LNK2005: _malloc already defined in
LIBCMT.lib(malloc.obj).
|
That you get whenever you link to EXEs/DLLs/LIBs that
use different RTLs in VC. You need to change this in
all your VC projects.
Schobi |
|
| Back to top |
|
 |
|