Same method name in different DLLs

I have two C++ files, "File1.dll" and "File2.dll". Both contain the implementation of a native method. The signature (name, arguments and return types) for each native method are identical, however, the code itself for each method is very different. For simplicity, assume both method are called runmethod(...).
Firstly I want to run the native method runmethod(...) contained in "File1.dll", and then a few lines of code later I want to run native method runmethod(...) in "File2.dll" .
I do a System.loadLibrary("File1.dll") and call runmethod(...) with no problems. However, my problem starts when I then do a System.loadLibrary("File2.dll") and call runmethod(...) again. Unfortunately, this runs runmethod(...) in "File1.dll"
Is there any way I can, when invoking a native method, force it to use a particular dll in cases where there is a name clash.
(Changing the C++ source code is not an option BTW. Unloading the first DLL would be ideal but I understand from looking at other threads this cannot be done. )
Many thanks in advance
David.

You have to dynamically load the second dll and create the method pointers yourself. This is somewhat akin to reflection in java. Note that doing this means that all of the methods have to be called that way (although you might be able to load it twice.)

Similar Messages

  • Same Input name with different data type cause the reflection exception

    I have a proxy contains couple RFCs. Two RFCs contain an argument named IN_COMPANY_CODE with data type of ZTRE_FX_BUKRSTable. Another RFC contains the same argument name of IN_COMPANY_CODE but hold different data type (String). All RFCs are in the same proxy. Complie and build the application with no issue.
    But when I ran the RFC, it generates the reflection exception below:
    Method SAPProxy1.Z_F_Tre_R_Pre_Trade_Fx can not be reflected. --> There was an error reflecting 'In_Company_Code'. > The XML element named 'IN_5fCOMPANY_--5fCODE' from namespace '' references distinct types System.String and MSTRFOREX.ZTRE_FX_BUKRSTable. Use XML attributes to specify another XML name or namespace for the element or types.
    I realize the conflict introduced by the same name with difference data type. But I would like to know if this is fixable as a bug or if there is any best practice and/or some manual intervention to make it work.

    Please install fix from OSS note 506603. After this, right-click .sapwsdl file and select "Run custom tool".

  • Interfaces with same method names

    Hello!
    A theoretical question:
    There's a class, which implements 2 interfaces. Each interface has a method 'modszer'. Here's the code:
    InterfaceA.java:
    interface InterfaceA {
      void modszer();
    InterfaceB.java:
    interface InterfaceB {
      void modszer();
    Osztaly.java:
    public class Osztaly implements InterfaceA, InterfaceB {
      public void modszer() {
        System.out.println("So, which?");
    FoOsztaly.java:
    public class FoOsztaly {
      public static void main(String[] args) {
        Osztaly o = new Osztaly();
        o.modszer();
        InterfaceA ia = o;
        ia.modszer();
        InterfaceB ib = o;
        ib.modszer();
    Sorry for the hungarian class names.
    So how can I implement both 'modszer' methods, for example the method belongs to InterfaceA should return 'A' and the method if InterfaceB should return 'B'?
    Thank you!

    Only if they have different return types.There can be a problem with inheriting a method from
    two different interfaces even if they have exactly the
    same signature.
    Consider the following interfaces and class:
    interface Rectangle {
    /** Display the rectangle on the screen */
    void draw();
    interface Card {
    /** Remove the card from the deck */
    void draw();
    class GraphicCard implements Rectangle, Card {
    /** What should this do!?!? */
    public void draw();
    }In this case, the draw() method in GraphicCard should
    satisify two different contracts -- which one should
    it satisfy? This is a real problem with multiple
    inheritance of interface. It isn't as much of a
    problem as multiple inheritance of implementation (as
    in C++), but it still can be a problem when interface
    methods have poorly chosen names.my solution to ur problem is
    interface Rectangle{
    void draw();
    interface card {
    void draw();
    class Test implements Rectangle, Card
    static String choice=null;
    void Test(String str)
    choice=string;
    void draw()
    if(choice.equals("Rectangle"))
    //do
    if(choice.equals("Card"))
    //do
    give this class to the user or application
    if he wants to use rectangle or card
    class User
    Recatangle rec=(Rectangle)new Test("Rectangle");
    rec.draw();
    Card card=(Card) new Card("Card");
    card.draw();
    get back to me if iam wrong
    regards
    kamal

  • How To Create Table View With Same Column name But Different Table?

    Hi All,
    I have the problem to create a tableview with same column name but in different table.
    The Table that i have:-
    Table - PAC051MPROFORMA
    Column - mrn,visitid
    Table - PAC051TPROFORMA
    Column - mrn,visitid
    Table - PAC052MTRANSBILL
    Column - mrn,visitid
    Then i want to create a table view to view that table. This is my SQL
    CREATE VIEW pacviewproforma (mrn,visitid,mrn,visitid,mrn,visitid)
    As Select PAC051MPROFORMA.mrn,PAC051MPROFORMA.visitid,PAC051TPROFORMA.mrn,PAC051TPROFORMA.visitid,PAC052MTRANSBILL.mrn,PAC052MTRANSBILL.visitid
    where
    *(a.PAC051MPROFORMA.mrn=PAC051TPROFORMA.mrn)*
    and
    *(a.PAC051TPROFORMA.mrn=PAC052TRANSBILL.mrn)*
    That SQL Return this error = ORA-00957: duplicate column name
    Then I modify that SQL to
    CREATE VIEW pacviewproforma (mrn,visitid)
    As Select PAC051MPROFORMA.mrn,PAC051MPROFORMA.visitid,PAC051TPROFORMA.mrn,PAC051TPROFORMA.visitid,PAC052MTRANSBILL.mrn,PAC052MTRANSBILL.visitid
    where
    *(a.PAC051MPROFORMA.mrn=PAC051TPROFORMA.mrn)*
    and
    *(a.PAC051TPROFORMA.mrn=PAC052TRANSBILL.mrn)*
    This time this error return = ORA-01730: invalid number of column names specified
    What should i do?
    Thanks...

    Hi,
    SQL> CREATE VIEW pacviewproforma (mrn,visitid,mrn,visitid,mrn,visitid)
      2  As Select
      3  PAC051MPROFORMA.mrn,
      4  PAC051MPROFORMA.visitid,
      5  PAC051TPROFORMA.mrn,
      6  PAC051TPROFORMA.visitid,
      7  PAC052MTRANSBILL.mrn,
      8  PAC052MTRANSBILL.visitid
      9  from PAC051MPROFORMA,PAC051TPROFORMA,PAC052MTRANSBILL
    10  where
    11  (PAC051MPROFORMA.mrn=PAC051TPROFORMA.mrn)
    12  and
    13  (PAC051TPROFORMA.mrn=PAC052MTRANSBILL.mrn);
    CREATE VIEW pacviewproforma (mrn,visitid,mrn,visitid,mrn,visitid)
    ERROR at line 1:
    ORA-00957: duplicate column namePlease give different names to each column.
    Something like this..
    SQL> CREATE OR REPLACE VIEW pacviewproforma (MPROFORMA_mrn,MPROFORMA_visitid,TPROFORMA_mrn,TPROFORMA
    _visitid,MTRANSBILL_mrn,MTRANSBILL_visitid)
      2  As Select
      3  PAC051MPROFORMA.mrn,
      4  PAC051MPROFORMA.visitid,
      5  PAC051TPROFORMA.mrn,
      6  PAC051TPROFORMA.visitid,
      7  PAC052MTRANSBILL.mrn,
      8  PAC052MTRANSBILL.visitid
      9  from PAC051MPROFORMA,PAC051TPROFORMA,PAC052MTRANSBILL
    10  where
    11  (PAC051MPROFORMA.mrn=PAC051TPROFORMA.mrn)
    12  and
    13  (PAC051TPROFORMA.mrn=PAC052MTRANSBILL.mrn);
    View created.
    SQL> DESC  pacviewproforma;
    Name                                      Null?    Type
    MPROFORMA_MRN                                      NUMBER
    MPROFORMA_VISITID                                  NUMBER
    TPROFORMA_MRN                                      NUMBER
    TPROFORMA_VISITID                                  NUMBER
    MTRANSBILL_MRN                                     NUMBER
    MTRANSBILL_VISITID                                 NUMBER
    ORA-01730: invalid number of column names specifiedThe list of column nmae you specified during the CREATE VIEW should match with the SELECT list of the view.
    Twinkle

  • Same index name for different tables in different schema

    Just a quick query
    Can two tables present in different schema of same database has same index name ?
    Will there be any problem?
    Thanks

    And just a quick answer:
    859486 wrote:
    Just a quick query
    Can two tables present in different schema of same database has same index name ?Yes.
    >
    Will there be any problem?No.
    >
    Thanks

  • Same AppSet Name, 2 Different Server (Prod and Dev) causing XML corruption

    Thx
    Edited by: Joan Perrella on Oct 2, 2010 12:33 AM

    Also, another scenario:  User tried to connect durring or after an Optimization is perpformed?
    Will this cause an AppInfo.XML corruption?  
    And what happens if the user changes between 2 different AppSets within the same server (Prod)?
    Will this cause the AppInfo.XML corruption?
      I have seen many different responses as to why this occurs, and until we upgrade to BPC 7.5 MS occurs, we need to better understand what is causing this, so that we can help our users better understand the current situation here. 
    We have deleted the duplicate AppSet within 2 different servers and renamed the duplicate AppSet within DEV to a unique name.  Also, had the users delete the corrupted AppInfo.XML file and so forthe, but still this Randomly Occurs to this date.
    Answers please....

  • COPYAPP same application name two different environments.

    I see that this has been discussed before. Using the Copyapp utility to copy from one app to another with two apps having different names. I want to copy a application from dev to prod with the same name.
    How does the properties file know which one is which? will it even work with properties file?
    Thanks in advance.
    PHR

    Hy John.
    I took a look to your post because I have been trying to use CopyApp utility.
    However, as I launch the utility, an error in DOS window returns:
    Exception in thread "main" java.lang.RuntimeException: PLANPROD_JDBC_DATABASE_TYPE is undefined or it's value is null at com.hyperion.planning.copyapp.CopyAppHelper.getConnectionInfo(Unknown Source) at com.hyperion.planning.copyapp.CopyAppHelper.getConnectionInfoFromPropertyFile(Unknown Source) at com.hyperion.planning.copyapp.CopyApp.main(Unknown Source)
    where PLANPROD is the source Planning application.
    I used your example creating the property file; here it is:
    APP1_JDBC_CATALOG=PLANPROD
    APP1_JDBC_DRIVER=hyperion.jdbc.sqlserver.SQLServerDriver
    APP1_JDBC_URL=jdbc:hyperion:sqlserver://<servername1>:1433
    APP1_JDBC_USERNAME=admin
    APP1_JDBC_PASSWORD=password
    APP1_JDBC_DATABASE_TYPE=SQL
    APP1_OLAP_SERVER=<servername>
    APP1_OLAP_USERNAME=admin
    APP1_OLAP_PASSWORD=password
    APP1_OLAP_APPNAME=planprod
    APP2_JDBC_CATALOG=PlanDev
    APP2_JDBC_DRIVER=hyperion.jdbc.sqlserver.SQLServerDriver
    APP2_JDBC_URL=jdbc:hyperion:sqlserver://<servername2>:1433
    APP2_JDBC_USERNAME=admin
    APP2_JDBC_PASSWORD=password
    APP2_JDBC_DATABASE_TYPE=SQL
    APP2_OLAP_SERVER=<servername>
    APP2_OLAP_USERNAME=admin
    APP2_OLAP_PASSWORD=password
    APP2_OLAP_APPNAME=PlanDev
    Please, note that I have been trying to copy the application (only the relational repository) on a different server (servername2), where no Hyperion products have been installed.
    I was wondering whether any Hyperion component or what else (JDBC connector?) has to be installed on the target server, too. Any idea?
    Thanks a lot.
    Best regards

  • Is it possible to create same DC (name) under different SC

    Hi Experts,
    I have a question on creating the DC in development prospective from NWDS 7.3.
    My requirement is as below.
    We have the below DC and SC structure.
    SC <ABC_SC>
        DC <XYZ_DC>
    SC<DEF_SC>
        DC<PSQ_DC>
    both the above SC's and DC's are already checked-in to DTR. Now the question is can I create the  same DC<PSQ_DC> under first SC? Ex as shown below?
    SC <ABC_SC>
        DC <XYZ_DC>
       DC<PSQ_DC>
    As I have developed web dynpro project it will be lot of difficult to create the dc with different name and move all the code? can you please let me know the possibility? would there be any naming convention issue and if yes, what would be the ideal solution for this scenario.
    Thanks a lot in advance.

    Thanks for the quick reply.
    Currently both the DC's on different SC's has been checked in to DTR as shown and explained in scenario1. However, if it is possible to create the same DC under first as shown in scenario 2. Then I'll delete or stop using DC<PSQ_DC> from the first scenario from DTR.
    Scenario1.
    SC <ABC_SC>
        DC <XYZ_DC>
    SC<DEF_SC>
        DC<PSQ_DC>
    Scenario 2.
    SC <ABC_SC>
        DC <XYZ_DC>
       DC<PSQ_DC>
    Please advise?

  • Same column name from different table

    i have a sql query as like this : "SELECT * FROM TABLE1,TABLE2". i use oracle. both TABLE1 and TABLE2 have the same column named 'COLUMN1'. while i get rows how i know the value of COLUMN1 from which table (TABLE1 or TABLE2).
    sample code snippet is above. do u help me!
    while (rs.next())
    value1 = rs.getString("COLUMN1");
    // is value1's value from table1 or table2. how do i know this?
    // i try value1 = rs.getString("TABLE1.COLUMN1"); but it doesn't work :(
    ....

    I case you don't know what an alias is, it would look something like this:
    SELECT a.COLUMN1 as FirstColumn1, b.COLUMN1 as SecondColumn1 FROM FirstTable a, SecondTable b
    Notice that in the FROM clause we've appended a short name for each table. You're not limited to one character, but I try to keep it simple. Now we can refer to the tables as a and b.
    Because I did that I have to refer to any ambiguous columns (although it's good practice to refer to ALL columns) using the table name prefix and a period. This tells the driver which "COLUMN1" I want. Then we include as AS clause which allows us to tell the driver what we want that column name to be when it's returned to us. This is specially usefule when I have two columns in two separate tables with the same name (as you have here) or if I'm calculating data (i.e. (a.QTY * b.PRICE) as UnitPrice) that doesn't have a column name, so here I can give it one.
    It's a little weird at first since you use the alias names in the select before you actually define them in the FROM clause, but you'll get use to it.
    Now you retrieve FirstColumn1 and SecondColumn1 from your ResultSet, not Column1.
    HTH.

  • Same album name by different artists

    Hi Everyone,
    Im having an issue that I have 3 x 'Greatest Hits' albums by 3 different artists. The problem is that on my 160gig Classic the menu shows each of the albums individually when scrolling through the 'artist' menu. However when scrolling through the 'album' menu the songs for all 3 'Greatest Hits' albums appear under 1 heading. They are not selected as being a compliation on either itunes or on the ipod directly. Is there any way to seperate them without changing the album names? Please Help!

    http://discussions.apple.com/thread.jspa?messageID=7743599&#7743599
    and
    http://discussions.apple.com/thread.jspa?messageID=7229921&#7229921

  • HT1451 I dont see my purchased movies on my AppleTV now that I had to change my Apple ID password, Same ID Name but different email.

    I have and IPad, IpadAir, Iphone 5S and and Iphone 4. I use a HP laptop for my Itunes Library with windows Vista. Since the IOS uograde on all devices I have had to keep re-doing my password for my Icloud, Itunes and Apple ID.
    I have not used a different ID, but the email has changed to multiple like @me.com, @icloud.com, @yahoo.com due to changes with my email provider and the new Icoud system.
    I have purchased several Apps, that will not upgrade now at all, Several Movies that only 2 show up on my library on my AppleTV and years of Music, that show up on my Laptop, but only some show up on my other devices.
    I checked the Laptop Itunes Library and all have purchased by my Account ID name without email ext.

    Settings>Store>Apple ID, tap the ID shown, sign out, sign back in using your ID.

  • Display images with same file name and different file types.

    I want to write a method, which receives file names (image1, image2, image3) but without the extension. This method will handle most of the image types (.jsp, .png, and ...) , what is the best way to write the method? Should I loop through all the image types for a given file name? I really don't want to do that...

    Topcan5 wrote:
    I want to write a method, which receives file names (image1, image2, image3) but without the extension. This method will handle most of the image types (.jsp, ..Since when are Java Server Pages an image type?
    .. .png, and ...) , what is the best way to write the method? Should I loop through all the image types for a given file name?.. Sounds reasonable.
    ..I really don't want to do that...Why not?
    As an aside, this entire task sound suspicious. Why on earth would you need such a method?

  • Loading dll of same assembly name

    In my application, I have two assemblies(third party) of different versions , publickeytoken but same assembly name in different app paths. For some of my projects the lower version of that dll is required and for some other higher version of that dll
    is needed. I have referred these two dll where ever it is needed. While compiling it doesn't throw any error. But in runtime i'm getting the following exception
        "Could not load file or assembly 'AssemblyName, Version=x.x.x.x, Culture=neutral, PublicKeyToken=xxxxxxx' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT:
    0x80131040)"
    Is there any way to load assembly by considering all four parameters?

    Steve,
         For your questions,
    Few functionality are not available in the higher version which were in lower version of that assembly, i mean to say i cant redirect lower version assembly to higher version<bindingRedirect>.
    I'm using VS2010 Professional version.
    None of these assemblies are in GAC.
    These dll's are not in same path.For example A(v2.0) is in app path and A(v1.0) is in app path\Assmebly. It doesnt override one another.
    Please let me know if u need more information
    Thanks
    Manojkumar.

  • TS1398 I am unable to connect to two different wifi at different locations having same name but different passwords

    I am unable to connect to two different wi if at different locations having same user name but different password one is at home other at work

    I was able to do a full reset on the router (pushing the tiny button near the power input). Then ran through the setup process and it started working on my device.

  • Files with same name in different packages

    I have a file with the same name defined in two different packages.
    When I generate the javadoc, I get an error saying that
    Class com.eg.toolkit.Email already defined in com.eg.common.Email.java
    Does javadoc expect all files to be of different names acroos packages?
    Thanks
    Chintu

    You can use the same class name in different packages.
    The Java API does that (java.awt.List, java.util.List).
    This is odd. What version of javadoc are you using,
    and what command are you passing in, with what classpath setting?
    -Doug Kramer
    javadoc team

Maybe you are looking for