SPONSORS:






User Tag List

Results 1 to 2 of 2
  1. #1
    Junior Member
    Join Date
    Jul 2001
    Location
    Beaverton, Oregon, USA
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need help on handling pointer in API Calls (DLL)

    Help,

    I am trying to add DLL calls in my test script.
    I understand using DLL declaration with function calls in Window APIs. (the
    Help index or user's manual).
    DLL "NameOfDll.dll"
    {
    prototype();
    Functions in DLL;
    Functions in DLL;
    }

    However, the APIs in the application written in C or C++ has pointers and
    Handles.
    How I could take care of the pointers and Handles in the above case.
    Especially the real-time application APIs use heavily pointers and Handles.
    If I need to create some other shells for the purpose, what should I do?

    <Example API call ??>
    Dll "PortalAPI.dll"
    {
    PORTAL_STATUS Fxn(PortalMessage_t* pPortalMsg)
    {
    if (pPortalMsg->PortalMsg.displayControl == PORTAL_MSG)
    printf("Received message: %s", pPortalMsg->PortalMsg.buf);
    }
    }

    I guess I need to add a string datatype PORTAL_STATUS , so on... (?), but
    how I could handle the pointers?

    - If anyone knows the answer or tips, please let us know.

    Thanks a lot,

    /John Yoo

    ------------------

  2. #2
    Senior Member
    Join Date
    Jan 2001
    Posts
    750
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Need help on handling pointer in API Calls (DLL)

    I think only char* can be handled by silk, using a string type.

    Other pointers are not supported. One thing you can do is to write your functions using 'unsigned int' type which is supported by silk.

    pointers contain positive integers as memory address. Hence you could have a function return a pointer that you want then pass it to a function receiving a pointer. All using 'unsigned int' type. The only thing is that when you want to use this unsigned int you have to cast it to the owner's type.


    ex:

    unsigned int p2int(void* p){return p;}

    void main(void)
    {
    char* p="GodKnows";
    cout<<(char*)p2int(p);
    cout<<p2int(p); //it doesn't display well

    }

    result:

    it prints GodKnows and the address #

    This requires some coding and changes to the implementation.

    The idea is that all your types must be supported by silk when using DLLs.
    ------------------


    [This message has been edited by GodKnows (edited 07-11-2001).]

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 04:09 AM.

Copyright BetaSoft Inc.