How to load function from derived class from dll

Dear all,
how to access extra function from derived class.
for Example
//==========================MyIShape.h
class CMyIShape
public:
CMyIShape(){};
virtual ~CMyIShape(){};
virtual void Fn_DrawMe(){};
// =========== this is ShapRectangle.dll
//==========================ShapRectangle .h
#include "MyIShape.h"
class DLL_API ShapRectangle :public CMyIShape
public:
ShapRectangle(){};
virtual ~ShapRectangle(){};
virtual void Fn_DrawMe(){/*something here */};
virtual void Fn_ChangeMe(){/*something here */};
__declspec (dllexport) CMyIShape* CreateShape()
// call the constructor of the actual implementation
CMyIShape * m_Obj = new ShapRectangle();
// return the created function
return m_Obj;
// =========== this is ShapCircle .dll
//==========================ShapCircle .h
#include "MyIShape.h"
class DLL_API ShapCircle :public CMyIShape
public:
ShapCircle(){};
virtual ~ShapCircle(){};
virtual void Fn_DrawMe(){/*something here */};
virtual void Fn_GetRadious(){/*something here */};
__declspec (dllexport) CMyIShape* CreateShape()
// call the constructor of the actual implementation
CMyIShape * m_Obj = new ShapCircle();
// return the created function
return m_Obj;
in exe there is no include header of of ShapCircle and ShapRectangle 
and from the exe i use LoadLibrary and GetProcAddress .
typedef CMyIShape* (*CREATE_OBJECT) ();
CMyIShape*xCls ;
//===================== from ShapeCircle.Dll
pReg=  (CREATE_OBJECT)GetProcAddress (hInst ,"CreateShape");
xCls = pReg();
now xCls give all access of base class. but how to get pointer of funciton Fn_GetRadious() or how to get access.
thanks in advance.

could you please tell me in detail. why so. or any reference for it. i love to read.
i don't know this is bad way.. but how? i would like to know.
I indicated in the second sentence. Classes can be implemented differently by different compilers. For example, the alignment of member variables may differ. Also there is the pitfall that a class may be allocated within the DLL but deallocated in the client
code. But the allocation/deallocation algorithms may differ across different compilers, and certainly between DEBUG and RELEASE mode. This means that you must ensure that if the DLL is compiled in Visual Studio 2010 / Debug mode, that the client code is also
compiled in Visual Studio 2010 / Debug mode. Otherwise your program will be subject to mysterious crashes.
is there any other way to archive same goal?
Of course. DLL functionality should be exposed as a set of functions that accept and return POD data types. "POD" means "plain-ole-data" such as long, wchar_t*, bool, etc. Don't pass pointers to classes. 
Obviously classes can be implemented within the DLL but they should be kept completely contained within the DLL. You might, for example, expose a function to allocate a class internally to the DLL and another function that can be called by the client code
to free the class. And of course you can define other functions that can be used by the client code to indirectly call the class's methods.
and why i need to give header file of ShapCircle and shapRectangle class, even i am not using in exe too. i though it is enough to give only MyIShape.h so with this any one can make new object.
Indeed you don't have to, if you only want to call the public properties and methods that are defined within MyIShape.h.

Similar Messages

  • Can I work with a derived class from u0093ApplicationClassu0094

    Hello, I want to create a derived class from “ApplicationClass” for use in my Application, the problem is the function “SAPbouiCOM.SboGuiApi.GetApplication(-1)”, it return a COM object. If I do a specific cast to my own class (that derive from ApplicationClass), the metod give a COM exception and say that I can’t do a specific cast with a COM object.
    Can I do that cast? And How can I do it?
    I’m programming in C#.
    Thanks.

    I think that you can´t assign an object of the base class
    to an object of the derived class. I don´t know why you need to do that. With more information we could help you

  • How to load data to a cube from multiple infosources ?

    Hi friends,
    How to load data to a cube from multiple infosources ? could u please answer this question .
    thanks in advance......

    Hi ,
    say for example you need to load data to 1 cube from 3 info sources:
    1) You need to create 3 update rules for the Cube.
    2) Each time you create the update rules. Mention the name the name of the Info source. and create update rules correspondingly.
    Regards
    satish
    Message was edited by:
            satish murthy

  • How do you call a java class from the main method in another class?

    Hi all,
    How do you call a java class from the main() method in another class? Assuming the two class are in the same package.
    Thanks
    SI
    Edited by: okun on May 16, 2010 8:40 PM
    Edited by: okun on May 16, 2010 8:41 PM
    Edited by: okun on May 16, 2010 8:47 PM

    georgemc wrote:
    To answer your impending question, either the method you're calling has to be static, or you need an instance of that other class to invoke it against. Prefer the latterAnd to your impending question after that: no, don't use the Singleton pattern.

  • Urgent: how to import or transport abap class from dev to q

    How to import/transport custom abap class from dev to q.
    Any suggestions points will be awarded.
    Thanks in advance.
    MK

    hi M K,
    try SE24, your class, and go to menu 'Go to' -> object directory entry,
    click pencil icon and give your package name, will raise request.
    SE10 to release and STMS from prod to import.
    hope this helps.

  • How to load master data and hierarchies from R/3 systems

    HI all,
    how to load master data and hierarchies from R/3 systems.
    Please explain the steps.
    Thanks,
    cheta.

    HI,
    Its normally done following: Transferring the master datasources in RSA5 to RSA6 and then replicating the DS into BW and assignment of DS to Infosource and cretaion of Infopackage and load it into the master tables.
    Generally, the control parameters for data transfer from a source system are maintained in extractor
    customizing. In extractor customizing, you can access the corresponding source system in the source
    system tree of the SAP BW Administrator Workbench by using the context menu.
    To display or change the settings for data transfer at source system level, choose Business
    Information Warehouse → General Settings → Maintaining Control Parameters for Data Transfer.
    Note: The values for the data transfer are not hard limitations. It depends on the DataSource if these
    limits can be followed.
    In the SAP BW Scheduler, you can determine the control parameters for data transfer for individual
    DataSources. You can determine the size of the data packet, the number of parallel processes for
    data transfer and the frequency with which the status IDocs are sent, for every possible update
    method for a DataSource.
    To do so, choose Scheduler → DataSource → Default Settings for Data transfer.
    In this way you can, for example, update transaction data in larger data packets in the PSA. If you
    want to update master data in dialog mode, smaller packets ensure faster processing.
    Hope this info helps.
    Thanks,Ramoji.

  • Is it possible to call methods from another class from within an abstract c

    Is it possible to call methods from another class from within an abstract class ?

    I found an example in teh JDK 131 JFC that may help you. I t is using swing interface and JTable
    If you can not use Swing, then you may want to do digging or try out with the idea presented here in example 3
    Notice that one should refine the abstract table model and you may want to create a method for something like
    public Object getValuesAtRow(int row) { return data[row;}
    to give the desired row and leave the method for
    getValuesAt alone for getting valued of particaular row and column.
    So Once you got the seelcted row index, idxSelctd, from your table
    you can get the row or set the row in your table model
    public TableExample3() {
    JFrame frame = new JFrame("Table");
    frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {System.exit(0);}});
    // Take the dummy data from SwingSet.
    final String[] names = {"First Name", "Last Name", "Favorite Color",
    "Favorite Number", "Vegetarian"};
    final Object[][] data = {
         {"Mark", "Andrews", "Red", new Integer(2), new Boolean(true)},
         {"Tom", "Ball", "Blue", new Integer(99), new Boolean(false)},
         {"Alan", "Chung", "Green", new Integer(838), new Boolean(false)},
         {"Jeff", "Dinkins", "Turquois", new Integer(8), new Boolean(true)},
         {"Amy", "Fowler", "Yellow", new Integer(3), new Boolean(false)},
         {"Brian", "Gerhold", "Green", new Integer(0), new Boolean(false)},
         {"James", "Gosling", "Pink", new Integer(21), new Boolean(false)},
         {"David", "Karlton", "Red", new Integer(1), new Boolean(false)},
         {"Dave", "Kloba", "Yellow", new Integer(14), new Boolean(false)},
         {"Peter", "Korn", "Purple", new Integer(12), new Boolean(false)},
         {"Phil", "Milne", "Purple", new Integer(3), new Boolean(false)},
         {"Dave", "Moore", "Green", new Integer(88), new Boolean(false)},
         {"Hans", "Muller", "Maroon", new Integer(5), new Boolean(false)},
         {"Rick", "Levenson", "Blue", new Integer(2), new Boolean(false)},
         {"Tim", "Prinzing", "Blue", new Integer(22), new Boolean(false)},
         {"Chester", "Rose", "Black", new Integer(0), new Boolean(false)},
         {"Ray", "Ryan", "Gray", new Integer(77), new Boolean(false)},
         {"Georges", "Saab", "Red", new Integer(4), new Boolean(false)},
         {"Willie", "Walker", "Phthalo Blue", new Integer(4), new Boolean(false)},
         {"Kathy", "Walrath", "Blue", new Integer(8), new Boolean(false)},
         {"Arnaud", "Weber", "Green", new Integer(44), new Boolean(false)}
    // Create a model of the data.
    TableModel dataModel = new AbstractTableModel() {
    // These methods always need to be implemented.
    public int getColumnCount() { return names.length; }
    public int getRowCount() { return data.length;}
    public Object getValueAt(int row, int col) {return data[row][col];}
    // The default implementations of these methods in
    // AbstractTableModel would work, but we can refine them.
    public String getColumnName(int column) {return names[column];}
    public Class getColumnClass(int col) {return getValueAt(0,col).getClass();}
    public boolean isCellEditable(int row, int col) {return (col==4);}
    public void setValueAt(Object aValue, int row, int column) {
    data[row][column] = aValue;
    };

  • [iPhone development] How to load the App Store directly from an app?

    I need to figure out how to load the app store from one of my applications by clicking a button. The code is relatively easy to load say a website. But when I use this code:
    -(IBAction)goToAppStore;
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://itunes.com/apps/appname"]];
    it does not work, because it says too many redirects occurred.
    Is there a way to load the app store (and load into a specific app info view) directly from the app, instead of loading a website to load the app store?
    Thanks very much,
    LOQ123

    Thank you.
    But I using the one line code I had too many redirects. So, I needed the latter code, which didn't load the app store until all the redirects have happened. Unfortunately I don't understand this code:
    // Process a LinkShare/TradeDoubler/DGM URL to something iPhone can handle
    - (void)openReferralURL:(NSURL *)referralURL {
    NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:[NSURLRequest requestWithURL:referralURL] delegate:self startImmediately:YES];
    [conn release];
    // Save the most recent URL in case multiple redirects occur
    // "iTunesURL" is an NSURL property in your class declaration
    - (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response {
    self.iTunesURL = [response URL];
    return request;
    // No more redirects; use the last URL saved
    - (void)connectionDidFinishLoading:(NSURLConnection *)connection {
    [[UIApplication sharedApplication] openURL:self.iTunesURL];
    I'm know where to implement the code, however I don't know where to put my link in inside the specific code up above.
    Please help me
    Thanks very much

  • How can I call a java class from within my program?

    I was wondering if there's a platform independent way to call a java class from my program.

    Here's my scenario. I'm working on a platform independent, feature rich, object-oriented command prompt program. The way I'm designing it is that users can drop classes they write into my bin directory and gain access to the class through my program. For example, they drop a class named Network.class in the bin directory. They would type Network network at my command prompt and gain access to all the methods available in that class. They can then type system.echo network.ipaddress() at my prompt and get the system's ip address. I have it designed that there's a server running in the background and the clients connect to my port. Once connected the end-user can enter their user name and password and gain access to the system. When they type a command they actually call another java program which connects to my server using a seperate thread. They can then communicate back and forth. I have it set that everything has a process id and it's used to keep track of who called what program. Once the program is done it disconnects and closes. Rather than getting into the nitty gritty (I didn't want to get into heavy detail, I know how everything will work) I'm really interested in finding out how I can call a java program from my program. I don't want it to be part of the app in any way.

  • SQL*Loader - How to load only a few columns from a .csv file to ora table

    Hi there,
    Could anyone please let me know how to load few columns from a .csv
    file into a oracle table using SQL*Loader.
    I know how to create a .dat and .ctl file and run the sql loader.
    Suppose I have a .csv file with
    col1, col2, col3, col4
    and I only need to load col1 and col3 into col_a and col_b respectively
    in table_a?
    structure of table_ a
    col_a,
    col_b
    Please advice

    Try like..it i will work..
    LOAD DATA
    INFILE 'test.txt'
    LOAD DATA
    TRUNCATE INTO TABLE T1
    FIELDS TERMINATED BY ','
    (col1,
    col2 FILLER,
    col3,
    col4 FILLER
    )

  • How to return a list of class from a package

    Hi,
    I'm trying to create a RPG game with 50 characters. There will be a superclass, and each character is a subclass that extends from the superclass. Each will have unique abilities that will be functions. These classes will be thrown into a package.
    I would like to know the code for returning the list of classes in that package. That way, I can present them as a list for the player to choose just a handful of characters to start out with.
    Thanks in advance         

    Hi u can use the this class
    flash.utils.describeType;
    Regards
    Sumit Agrawal

  • How to call a ABAP proxy class from a BADI? Please help!

    hi Experts,
        I have a scenario where I have to call a ABAP proxy class from a BADI. How can I do this? Does anybody has sample code for the same?
    Please help.
    Thanks
    Gopal

    Hi Gopal,
    Check this out
    DATA: ref_obj    TYPE REF TO zmfg_production_ord.----> BADI
    * Instantiate the proxy class
        CREATE OBJECT ref_obj.
        TRY.
            CALL METHOD ref_obj->execute_asynchronous
              EXPORTING
                output = it_output.     "Output Structure
            COMMIT WORK.
          CATCH cx_ai_system_fault INTO ref_sysexception.
        ENDTRY.
        IF  ref_sysexception IS INITIAL.
          WRITE : / 'Error Message'.
        ENDIF.
    Edited by: Raj on May 28, 2008 4:52 PM

  • How sholud we call one jframe class from another jframe class

    Hi
    In my application i am calling one jframe class from another jframe clas.
    how sholud we make previous jframe inactve when another jframe is invoked?(user sholud not able to make any changes on on parent jframe window when another jframe is invoked)
    Pls reply.

    Sorry for me it is not possible to change existing code,
    pls suggest me any other solution so that i can inactive parent jframe when child jframe execution is going on.

  • How to load data into an ods from multiple info sources.

    hi all...
    i am given a task to load data into an ods from 3 infosources ...
    can someone plz give me the flow .
    thank u in advance..

    Hi Hara Pradhan,
    You have to create 3 update rules by giving the 3 different infosources while creating each update rule. And u have to create the infopackages under each infosource. with this u can load the data to the same data target from multiple info sources.
    Hope it helps!
    Assign points if it helps!

  • How to access super of enclosing class from inner class?

    Hello,
    I'd like to access Base.foo() from inner class in overridden Improved.foo(), but seem unable:
    public class InnerSuper {
         public static class Base {
              protected int foo() {
                   return 1;
         public static class Improved extends Base {
              @Override
              protected int foo() {
                   return Integer.parseInt(new Object () {
                        public String toString() {
                             return "1"+foo() ;
                   }.toString());
         public static void main(String[] args) {
              System.out.println(new Improved().foo());
    }The code above does not work, as it recursively calls Improved.foo() where I'd like it to call Base.foo(). What syntax construct should I use? Improved.this would be the same thing, Improved.super does not exist.
    I came up with a work around: adding a method baseFoo() to Improved and call that in the inner class:
       int baseFoo() {
          return super.foo();
       } but remain wondering if that is necessary?

    Indeed, Improved.super.foo() is allowed. My Eclipse syntax highlighting seems to have the same opinion as you: "are you sure you want to write that kind of code?" and leaves the read underlining for a syntax error on for just a second longer.
    This is where I am now:
         public static class DeferredExecSubroutineCall extends SubroutineCall {
              RelayExecutor relay;
              public DeferredExecSubroutineCall(RelayExecutor relay) {
                   this.relay = relay;
              @Override
              protected String execute(final IFDSOC fd, final String commandText) {
                   Future<String> f = relay.submit(new Callable<String>() {
                        @Override
                        public String call() throws Exception {
                             return DeferredExecSubroutineCall.super.execute(fd, commandText);
                   try {
                        return f.get();
                   } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                   } catch (ExecutionException e) {
                        if (e.getCause() instanceof RuntimeException) {
                             throw (RuntimeException) e.getCause();
                        } else {
                             throw new RuntimeException(e.getCause());
         }which is my current effort of adding concurrency to an existing project. I find it quite elegant but I am interested to hear from you...

Maybe you are looking for