Announcement

Collapse
No announcement yet.

How to expose multiple functions using .4FN.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to expose multiple functions using .4FN.

    Hi,
    I am designing an application in 4DVisi. I had already designed a list box control in 4DGL. Here what i want that i need to use this list box control in my 4DVisi application. Recently i have seen a sample demo project where one function named func popupMessageBox(var xpos, var ypos, var title, var text, var type, var icon) is called using file_LoadFunction("POPMSG.4FN"). So when i opened its source code (POPMSG.4DG), i could see the above mentioned function only. So i tried this approach to expose more than one function from my listbox control project. But i am not getting any .4FN file while compiling my source code,what i am getting that a .4XE. Is it possible for me to use .4XE instead .4FN. Please help me....
    RHS

  • #2


    The only difference between a .4fn and a .4xe is that a .4fn has parameters (variables) passed to main.

    You can still load a .4xe as a function if you want.

    When you put the variables into main a .4fn will be created when you compile
    Mark

    Comment


    • #3


      Thanks moderator for your extreme support. Actually what i mean that, i want to design a ListBox control which shall expose more than one APIs and should not contain any main(). Because if i include this Lisbox in another 4DVisi project, there is a possibility for occurring multiple mains(). That is why i want to avoid main() function in my ListBox project but at the same time it has to generate a .4FN file. Is it possible. I have tried by defining two function in my project ListBox and i got ListBox.4XEfile. I Called these function in the following way from my 4DVisi application ,

      LixtBox := file_LoadFunction("ListBox.4XE"); // load the popup message box function if(LixtBox TestFunction1(1, 2);

      TestFunction2(1, 2);
      mem_Free(popupMessageBox); else print("File read Error..."); endif

      While compiling source code, I am getting error: TestFunction1 and TestFunction2 not found
      .I don't know i can call these functions in this way. If it is wrong, please tell me how could i solve this problem. Thanks...
      RHS

      Comment


      • #4


        No, it doesn't work that way, you can only have one function per .4fn (or .4xe) it is referenced by the handle only, so it's whatever you cal the handle.

        To have multiple functions, just add an extra parameter and have that determine what function is internally referenced.
        Mark

        Comment


        • #5


          Ok...thanks moderator...i think this will solve my problem.....
          RHS

          Comment


          • #6


            Thanks...moderator....i have designed a list box control which exposes more than one function through a single main function. Its working fine now...
            RHS

            Comment

            Working...
            X