Author Topic: input the symbols reference manually  (Read 4516 times)

issam

  • Guest
input the symbols reference manually
« on: May 16, 2006, 11:45:36 am »
HI

i want to make a static build of OSG like described here :
http://www.openscenegraph.org/osgwiki/pmwiki.php/Tasks/Win32StaticLink

everithing work fine except in step 8 :

i must to enter the symbols that need to be loaded manually to the linker

from original page :

8. Setup linker

force symbol includes for plugins using C++ mangled names from above (to defeat /OPT:REF which would ignore/discard them).
We now need to list all those registration-object symbol names for the linker to forcibly bind them in, even though it doesn't think they're referenced or used from anywhere.

    * In VC++7, this is in the Project properties, Linker section, Input subsection. Add each mangled symbol name (space delimited) on the line next to Force Symbol References. Alternately, open the multiline editor with the ... button on the right and enter each on its own line.
    * Ben Crossman notes that you can also accomplish this by adding a #pragma line to one of your application's main source modules:

 #pragma comment(linker, "/include:?g_readerWriter_3DS_Proxy@@3V?$RegisterReaderWriterProxy@VReaderWriter3DS@@@osgDB@@A")

    * Add Force Symbol References for the registration object for every plugin you intend to use. If you do not, no errors will occur during compiling or linking, but at runtime your plugin will not be found and your file(s) will not load.

so it seem to work on MSVS but on mingw i dont know how to do this

i read some mingw Doc without success

so any help is welcome

Thanks

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: input the symbols reference manually
« Reply #1 on: May 16, 2006, 03:08:26 pm »
Gcc, to my knowledge, does not support function-level linking.

However, if I am not mistaken, you don't necesarily need this step. As described in step #6, the purpose of this procedere is to reduce the monolithic library's size by hardcoding which functions to include using a #pragma directive in another step.

That's a nasty hack at best. If you make any reasonable use of the library, this will not buy you a lot, since you will use the major part of the functions anyway (if you link to 80% of the library manually, you can as well link to 100% without using hacks).

If, on the other hand, you do indeed not use the major part of the functions, then your approach is not good. First, you should ask yourself why you link to a library (building up a useless dependency) if you don't use the major part of it. Second, if you really only use a small subset, you can as well link statically, which is a lot better in every respect (smaller total binary size, no separate DLL, no dependency, no pain with string constants...).

"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: input the symbols reference manually
« Reply #2 on: May 16, 2006, 03:12:42 pm »
Gcc, to my knowledge, does not support function-level linking.
...which might in fact be incorrect.

I guess you can achieve that effect by creating a .def file and stripping out everything you don't want in an editor... but that's as much of a hack as the MS solution. I would not try it in any case, you create more problems than it is worth.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

issam

  • Guest
Re: input the symbols reference manually
« Reply #3 on: May 17, 2006, 10:22:59 am »
Thanks thomas

i find another solution is to include the plugins source directly to my app

it work but i get new pb :

performance drop
other pb .... but this my pb


as for the forum :
i was really surprised by the number of frequentation (great news)

so ... long long life to mingw and codeblocks

thanks again