How to make the symbol to be resolved within the shared library ?

I have two definitions of a symbol, one is in the main code, the other in a shared library. I want the symbol to be resolved within the shared library if it needed in the shared library.
From the 'C++ User�s Guide', use the option '-Bsymbolic' to build the shared library is a choice. But it also said 'Never use -Bsymbolic with programs containing C++ code, use linker map files instead. So I have to try to use the map file, but I did not get more useful information from 'Linker and Libraries Guide'.
I want to know what should be included in the map file and how to generate the map file?
Additionally, from the 'Linker and Libraries Guide', the 'Direct Binding' also could resolve this problem. And I tried to build the shared library by the '-B direct' option, it works.
Could anybody tell me what's the difference between the '-Bsymbolic' and '-B direct'?
Any comments are appreciated.

You didn't provide fun.h, and you didn't show all the commands that you must have used -- there are no commands that compile the source code into .o files. So I can't tell why the -xldscope option didn't work for you.
Problems and errors that I see in your example:
Functions func and swap are referenced from C code, but swap and one of the func functions are compiled by the C++ compiler and will get mangled names. If you compile a function with the C++ compiler that is to be called from C code, you need to declare the function as extern "C". But the extern "C" in a shared header needs to be guarded by +#ifdef __cplusplus+, since a C compiler won't understand the declaration.
When you build a shared library, you must explicitly list the libraries it depends on, since no dependencies are created by default. For a C++ library, you need at least -lCrun -lc in that order. Otherwise, in a real-world program you can have program failures due to incorrect library initialization order. To be sure you have listed all needed libraries, use the -zdefs option, which causes the linker to complain about missing definitions.
To be sure the shared library is picked up at run time, provide a RUNPATH via the -R option when you build the executable.
The -xldscope option must appear on compile commands for the files where you want it to take effect. It has no effect on a link command, because the option affects how code is generated.
Here is my rewrite:
% cat fun.h
#ifdef __cplusplus
extern "C"
#endif
void func();
#ifdef __cplusplus
extern "C"
#endif
void swap();
% cat fun.c
#include <stdio.h>
#include "fun.h"
extern "C" void func()
    printf("func in the shared lib\n");
extern "C" void swap()
    func();
% cat fun_in.c
#include <stdio.h>
#include "fun.h"
void func()
    printf("func in the main code\n");
% cat main.c
#include <stdio.h>
#include "fun.h"
int main()
    func();
    printf("invoke the swap:\n");
    swap();
% CC -G -xldscope=symbolic fun.c -Kpic -o liboutside.so -lCrun -lc -zdefs
% cc -o run main.c fun_in.c -L. -loutside -R .
% ./run
func in the main code
invoke the swap:
func in the shared libAs you can see, it works as advertised.
Please note that the -xldscope option affects all functions in the module. If you need more fine-grained control, you must add declarations to the source code, or use a mapfile instead of -xldscope .

Similar Messages

  • How to make use of adjacent data elements within the same buffer

    Hi,
             Does anyone know how to make use of adjacent data elements within the same buffer? To make my question clearly, I would like to give you an example. In my application, I set "sample to read" as 10 which means at each loop 10 data samples will be taken into a buffer. Now, what I would like to do is to do some calculations on adjacent data samples in same buffer. I tried to use "shift register" for this, but it seemed to me that it only can deal with the calculation between data from adjacent loops. In other words, it skips 9 data elements and take the 10th one for the calculation.
             Here I also attach my VI showing what I did.
        Thank you very much in advance,
                            Suksun
    Attachments:
    wheel_encoder_1.vi ‏98 KB

    Hi Suksun,
          I hope you'll forgive me for distilling your code - mainly to understand it better.  I tried to duplicate your logic exactly - which required reversing the "derivatives"-array before concatination with the current samples array.  As in your code, the last velocity is being paired with the first position.  If first velocity is really supposed to be paired with first position, just remove the "Reverse 1D Array" node.
    cheers
    Message Edited by Dynamik on 01-07-2006 03:17 AM
    Message Edited by Dynamik on 01-07-2006 03:19 AM
    When they give imbeciles handicap-parking, I won't have so far to walk!
    Attachments:
    encoder2.GIF ‏14 KB
    encoder2.vi ‏102 KB

  • How to make ENTER key in internet explorer run the  BIP report?

    In BI publisher 11g, users wanted that after entering the values for the parameter, they hit the ENTER key ( on the keyboard)  and the report should run .
    In Mozilla firefox, when I hit ENTER key on the keyboard report runs fine... but in Internet explorer, it does not ( infact in internet explorer TAB key works)
    How to make ENTER key in internet explorer run the report?
    Thanks
    Ashish

    Perform the following steps and tell us if it  resolve this issue:
    1. In Internet Explorer, click Tools, and then click Internet Options.
    2. Click the Security tab.
    3. There are four security zones listed:
    * Internet
    * Local intranet
    * Trusted sites
    * Restricted sites
    Click the zone being used by P6, which is noted at the bottom right hand corner of the browser window when the P6 URL is being accessed.
    4. Under Security level for this zone, click Custom Level.
    5. Under Downloads, under Automatic prompting for file downloads, click Enable, and then click OK two times.
    6. The browser will need to be restarted for the change to take effect.
    Refer to the following Microsoft Knowledge base article for additional file download and active x controls which should also be enabled: http://support.microsoft.com/kb/883255

  • How can I will declare the symbol u2018 (Single Quote) in the report

    Hi ,
    Could you please tell me how can I will declare the symbol u2018 (Single Quote) in the report.
    My requirement is that I have concate the data with single quote and after that I have to store the data in to an internal table and I have to download the data in the form text file in the presentation server.
    For example :
    Let the below data I want to download into the presentation serve in the format of text file by storing in internal table.
    Assume all are constants:
    1st line : abcu2019add
    2nd line :  defu2019gef
    Thanks in advance.

    Hi Jyothi,
    Thanks for the quick reply .
    I can agree with you are point but My requirement is like this I am explaining clearly.
    I have declared the internal table like this.
    DATA: BEGIN OF OTAB OCCURS 0,
             LINE (9024),
           END OF OTAB.
    So I have to append the each line item into the internal table.
    So I am explaining what the data I have to append
    Ist line contains
    'UNBUNOC:2020308u2019 where 020308 I will get the  date from reguh table
    2nd line contains:
    'DTM+20020510' where the 20020510 will be reference document number from the table reguh.
    So I want to declare a constant 'UNBUNOC:2
    2nd the date from reguh table
    And another constant u2018
    So that I can concate all the three and I can put into string and I will append into internal table and I can download the data into the presentation server.
    Please let me know if you need any more clarification regarding my requirement.
    Thanks in advance.

  • What does the symbol with a lock inside the refresh key in the upper right of my iphone4s and how do I unlock it?

    What does the symbol with a lock inside the refresh key in the upper right corner of my iphone4s mean and how do I unlock it?

    This is all covered in the manual:
    iPhone User Guide (For iOS 5.1 Software)

  • How to make a redirect without auto-redirect from the portlet "edit" mode?

    How to make a redirect without auto-redirect from the portlet "edit" mode?
    I use some sofisticated customizing with server-side validation of the form data. I want to redirect to the page of the portlet "show" mode and to the "edit" mode depending on the validation results. How can I do it?

    Heay.....this worked for me.
    I am able to change the mode programatically from edit to show.
    HttpPortletRendererUtil.handleEditAction(portletRenderRequest,"OK");
    I removed Apply , OK and Cancel buttons and applied my own Submit and Back button in Personalize mode and then change the mode to show on click of Back button using the above mentioned statement.
    Thanks
    ~Neeraj Sidhaye
    Try_Catch_Finally @ Y !
    ExtremePortal @ Gmail&#12288;&#65316;&#65359;&#65364;&#12288;&#65315;&#65359;&#65357;

  • How to make Math symbols in Skype conversations

    I use skype A LOT to talk to my Math Professors and it would be greatly appriciated if someone could show me how to make Math symbols in Skype without having to copy and paste them. In any other application on my computer I can make a squareroot symbole while pressin alt 251 √ but sith skype it just gives me û. This is very frustrating. If anyone has any sugestions please let me know. Thanks

    Try with ALT+8730
    http://symbolcodes.tlt.psu.edu/bylanguage/mathchar​t.html#common

  • How to make an ebook and sell it on the ibook or app store??

    How to make an ebook and sell it on the ibook or app store??
    Can anybody help me please T^T
    By the way I'm in Thailand and want to sell my ebook around the world.
    This is my dream ^^.. Help me please...

    Hi,
    Start with the ADC iOS dev center here.
    http://developer.apple.com/devcenter/ios/index.action
    Carolyn

  • Hi , How to make a calculated kf as local in the query definition

    Hi ,
    How to make a calculated kf as local in the query definition
    Regards,
    Ravi.

    Hi,
    Calculate KF consists of Basic, restrict and other calculated kFs stored in Metadata repository.
    Calculate KF is a replicate of Formula and acts as Global.
    Calculate KF acts as Global--you can use Globally.
    Formula as Local--you can use as local to Query.
    you can create the Calculate KF as follow:
    Goto Query Designer>Open/Create Query>Select Key Figures Mode on left side of Query>Select that KF node> right click Select Calculate Keyfigure.
    then one popup window dispays, so you make the calculations based on Basic KF, Restirct Kf and Formule. then save it.
    Regards,
    Suman.

  • How to make more than one person can access the database at one time

    how to make  more than one person can access the database at one time 

    Please post further f'up's in the Access forum.
    In short: for different reasons it is best practice that each user gets its own local copy of the database. This means that you need to split it into a front-end which only consists of the forms, queries, reports etc. Everything which doesn't need to be
    shared. And a back-end, which only stores the data.
    Take also a look at Allen Browne's article:
    Split your Access database into data and application.
    When you've splitted your database, you may often consider to use SQL Server as back-end. Here you may read Armen Stein's
    The Best of Both Worlds: Access-SQL Server Optimization.

  • Hello, i would like to know how to make horizontal sites and it moves with the scroll

    Hello, i would like to know how to make horizontal sites and it moves with the scroll

    Hi
    You can refer to these videos :
    http://www.lynda.com/Muse-tutorials/basics-horizontal-scrolling-websites/108131/115685-4.h tml
    https://www.youtube.com/watch?v=gZI_K1TXqOM
    Thanks,
    Sanjit

  • CF Ajax - how to make a small form 'pop up' over the existing content

    hi. i have a standard html form with quite a few elements
    (selects, radio buttons, input fields, text areas etc)
    some users will need the ability to supply additional data
    but i only want the fields for this additional data to appear upon
    request (to keep the form clean looking for the majority of users)
    i want to make it when users click on an "add more detail"
    button then the screen goes 'greyed out' and a new form appears
    roughly 350px x 350px centred on their screens. ive seen this done
    quite a lot recently and was just about to google javascript
    tutorials to get started, then it occured to me i may be able to
    utilise cf8's ajax tags to achieve this (which would be handy as i
    really struggle with anything other than v basic javascript)
    my requirements are:
    1 button (or link) in my standard form that launches the
    'more detail' form in a ?layer? over the top of the existing
    content
    2 when this happens the existing content is 'greyed out'
    preventing uses from interracting with it until they either
    complete this new form (or click the close button in that new form)
    3 this form is to contain 2 text inputs and a submit button
    4 i want to pass the data from this form back to the original
    form when it is submitted (temporarily storing the data in hidden
    fields within the original form) and will then ultimately pass this
    back to the server when the original form is submitted
    does anyone know if cfajax can help me with this (i dont need
    the asynchronous server interaction stuff ajax offers only the
    javascript to make my form pop up etc)
    if not does anyone know what this behaviour is commonly
    termed so i can google for it
    thanks very much indeed for any help
    cheers
    Nick

    Hi,
    i am not sure this serves ur purpose..but u can use try using
    cfwindow for this...this tutorial might help u get started..
    http://tutorial6.learncf.com/

  • How to run the Invoices in different groups within the batch in AP

    Need to know that how to run the Invoices in different groups within the batch. This will be of very helpful when we deal with lot of lines under one batch. (e.g) like somewhere we issued a Corporate Card to all the employees Via Bank Of America. Every Month they will send the complete details of all the employees who ever swiped the corporate provided BOA. Accordding to Natco all those lines should be loaded as One Invoice so that a Single Payment can be provided to BOA and it will also makes their life easier. This standard program sometimes it works normal sometimes it will run like a TORTOISE. So thats why in the manual they suggested to use GROUP ID to split the Invoice Load.
    So plz tell me how we can run it
    plz give me the solution
    thanks

    can you give me some material or document on that so that i can read actuaaly i need to make doc on it..

  • How to make an checkbox editable and uneditable within a single alv output.

    Hi,
    How to make an checkbox editable and uneditable within a single alv output depending on condition.
    I have used Reuse_alv_grid_display.
    In my output every checkbox is editable. i have used edit = 'X'.
    I want editable checkbox for correct value and uneditable checkbox for incorrect value in a single alv

    >
    Mukilansap wrote:
    > I want editable checkbox for correct value and uneditable checkbox for incorrect value in a single alv
    Use alv styles to achieve this, set the style for each record before displaying the ALV. Structure LVC_S_STYL.
    Take a look at the example BCALV_EDIT_02, it is OOPS based, but check how the style table is filled.
    regards,
    Advait

  • PLS-00103: Encountered the symbol "" when expecting one of the following:

    Hi I am creating trigger using CFQUERY tag of cold fusion on oracle..
    <CFQUERY DATASOURCE="CRM">
    create or replace trigger AWC_ACCESSROLESID_TRI
    before insert on AWC_ACCESSROLES
    for each row
    begin
    select AWC_ACCESSROLESID_SEQ.nextval into :new.AR_ID from dual;
    end;
    </CFQUERY>
    But the created trigger is not compiled, it is giving the following error
    "Line # = 1 Column # = 6 Error Text = PLS-00103: Encountered the symbol "" when expecting one of the following: begin case declare exit for goto if loop mod null pragma raise return select update while with <an identifier> <a double-quoted delimited-identifier> <a bind variable> << close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge <a single-quoted SQL string> pipe The symbol "" was ignored."
    If I edit that trigger in enterprose manager console by pressing space and compile that, it is working fine with out any error. If i run the above statement in sql *plus, It is working fine with out any error.
    Can you please tell me why this is happening if i run it using cfquery tag and also the possible solutions.
    Thanks in advance,
    Vinod

    So it works in Enterprise manager. It works in SQL*Plus. It doesn't work in CFQUERY. Sounds to me like a ColdFusion problem rather than an Oracle problem to be honest. Aren't there any ColdFusion support resources?
    Cheers, APC

Maybe you are looking for