From: Duncan on
Hi,

I've seen this occurs with third party .libs built using VC7.1, when trying to build on VC8/VC9.

The third-party supplier might be able to supplier a newer .lib, built with a later version of VC. However, this is not always the case, and in any event, it will mean waiting.

If you're running into the problem after a VC migration, and either don't want to wait, or can't get a newer .lib from the third party, here's a nifty way around the problem.

Create a DLL in your old development environment. Wrap all the functions in the .lib (or at least, the ones you need) with functions in your DLL. Keep the function signatures the same to provide an (almost) drop-in replacement interface to the DLL, but make sure you alter the name of the functions to avoid conflict with the ones in your third-party library and header. For example, prefix each function with a W_ (for 'wrapper'). You'll need to figure which version (single/multithreaded, dynamic/static, debug/release) of the CRT you need to link to, but that should be easy if you had things working nicely in your old development environment. Link your DLL to the .lib, and build it.

Then, using your new development environment, modify your project to link to the export library of your DLL rather than the .lib you have, and #include the DLL header in preference to the header for the .lib. Replace instances of calls to the original functions with the wrapper functions, and build.

Hey presto, you're now re-using that old .lib that VC8 or VC9 doesn't like.

I hope that helps someone.




Joseph M. Newcomer wrote:

__iob is one of the internal symbols for the stdio FILE* table.
25-Aug-09

__iob is one of the internal symbols for the stdio FILE* table. You seem to have done
something to exclude the standard C libraries from being loaded.
joe

wrote:

Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm

Previous Posts In This Thread:

On Tuesday, August 25, 2009 6:55 AM
James Duy Trinh \(VietDoor\) wrote:

unresolved external symbol __iob
Hi all,

I have a library. I got error below after including it into my project. I
changed the runtime lib setting of code gerneration, but still not work. Any
idea? Pls help me.
mylibrary.lib(jerror.obj) : error LNK2019: unresolved external symbol __iob
referenced in function _output_message

On Tuesday, August 25, 2009 9:56 AM
Joseph M. Newcomer wrote:

__iob is one of the internal symbols for the stdio FILE* table.
__iob is one of the internal symbols for the stdio FILE* table. You seem to have done
something to exclude the standard C libraries from being loaded.
joe

wrote:

Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm


Submitted via EggHeadCafe - Software Developer Portal of Choice
Screen.MousePointer = hand in VB 6.0
http://www.eggheadcafe.com/tutorials/aspnet/16e5eb76-3f70-42c1-89b6-8610d3712835/screenmousepointer--han.aspx
From: Joseph M. Newcomer on
NOte that there are certain risks when doing this. For example, you can't expect to use
free/delete on objects allocated by the library, or, if you pass an object you create
outside the library into the library, and the library expects to delete it, it cannot be
deleted successfully.

A number of libraries make the assumption that there is a uniform heap. They will not
work correctly if this assumption is violated.
joe

On Sat, 19 Dec 2009 21:38:20 -0800, Duncan Mackay wrote:

>Hi,
>
>I've seen this occurs with third party .libs built using VC7.1, when trying to build on VC8/VC9.
>
>The third-party supplier might be able to supplier a newer .lib, built with a later version of VC. However, this is not always the case, and in any event, it will mean waiting.
>
>If you're running into the problem after a VC migration, and either don't want to wait, or can't get a newer .lib from the third party, here's a nifty way around the problem.
>
>Create a DLL in your old development environment. Wrap all the functions in the .lib (or at least, the ones you need) with functions in your DLL. Keep the function signatures the same to provide an (almost) drop-in replacement interface to the DLL, but make sure you alter the name of the functions to avoid conflict with the ones in your third-party library and header. For example, prefix each function with a W_ (for 'wrapper'). You'll need to figure which version (single/multithreaded, dynamic/static, debug/release) of the CRT you need to link to, but that should be easy if you had things working nicely in your old development environment. Link your DLL to the .lib, and build it.
>
>Then, using your new development environment, modify your project to link to the export library of your DLL rather than the .lib you have, and #include the DLL header in preference to the header for the .lib. Replace instances of calls to the original functions with the wrapper functions, and build.
>
>Hey presto, you're now re-using that old .lib that VC8 or VC9 doesn't like.
>
>I hope that helps someone.
>
>
>
>
>Joseph M. Newcomer wrote:
>
>__iob is one of the internal symbols for the stdio FILE* table.
>25-Aug-09
>
>__iob is one of the internal symbols for the stdio FILE* table. You seem to have done
>something to exclude the standard C libraries from being loaded.
>joe
>
>wrote:
>
>Joseph M. Newcomer [MVP]
>email: newcomer(a)flounder.com
>Web: http://www.flounder.com
>MVP Tips: http://www.flounder.com/mvp_tips.htm
>
>Previous Posts In This Thread:
>
>On Tuesday, August 25, 2009 6:55 AM
>James Duy Trinh \(VietDoor\) wrote:
>
>unresolved external symbol __iob
>Hi all,
>
>I have a library. I got error below after including it into my project. I
>changed the runtime lib setting of code gerneration, but still not work. Any
>idea? Pls help me.
>mylibrary.lib(jerror.obj) : error LNK2019: unresolved external symbol __iob
>referenced in function _output_message
>
>On Tuesday, August 25, 2009 9:56 AM
>Joseph M. Newcomer wrote:
>
>__iob is one of the internal symbols for the stdio FILE* table.
>__iob is one of the internal symbols for the stdio FILE* table. You seem to have done
>something to exclude the standard C libraries from being loaded.
>joe
>
>wrote:
>
>Joseph M. Newcomer [MVP]
>email: newcomer(a)flounder.com
>Web: http://www.flounder.com
>MVP Tips: http://www.flounder.com/mvp_tips.htm
>
>
>Submitted via EggHeadCafe - Software Developer Portal of Choice
>Screen.MousePointer = hand in VB 6.0
>http://www.eggheadcafe.com/tutorials/aspnet/16e5eb76-3f70-42c1-89b6-8610d3712835/screenmousepointer--han.aspx
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm