web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

calling dll from dexterity

(0) ShareShare
ReportReport
Posted on by 255

hi,

i am trying to call a dll(developed in VC++) from dexterity,but it triggers an error saying

"Could not call external 'FunctionaName@DLLName.dll'' "

DLL is located inside in a application folder.I have maped the system path.

Can anybody have a solution for this..

thanks

nilotpal  

 

 

*This post is locked for comments

I have the same question (0)
  • Mariano Gomez Profile Picture
    26,225 on at
    Re: calling dll from dexterity

    Have you tried registering your DLL first? DLLs don't get typically registered automatically unless they are in the Windows\System32 folder. If you are working with Dynamics GP 10, move your DLL to the GP\AddIns folder, that way it will be loaded by the Dynamics GP runtime engine when GP is launched.

  • Nilotpal Cho Profile Picture
    255 on at
    Re: Re: calling dll from dexterity

    hi,

    thanks a lot for ur reply.

    But my problem is still there.

    Now,In VB2005 i have created a Dll (ETGP.dll) with the coding as,

    STEP1: 

    public class ETGP

      public function ETGP()

          Dim arr as string="hi"

          Return arr

      end function

    end class

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

    STEP2 

    Now in Dex i have created a script named as " ETGP@ETGP.dll " with the folowing code,

    out string msg;

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

    STEP3 

    Now, i am calling the Same script from other location as,

    extern 'ETGP@ETGP.dll',msg;

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

    i am getting the error as,

    Could not call external 'ETGP@ETGP.dll'

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

    I have included the dll under GAC and dexterity folder (from where i will be launching the Dexterity).

    i am working in (Dexterity)Clrl+t mode(deveopment mode of GP).

     

  • Greg Frazier Profile Picture
    685 on at
    Re: Re: Re: calling dll from dexterity

    Cho, here ya go:

    1.  First, set up a procedure script with the exact name of the .dll you are calling, and the method within the .dll you are running.  Be sure to include any parameters in the body of the script that are passed to the .dll.  No other code is required.  See the following example:

    {PsiActivate60DayTrial@PSIKey.dll} <-- This is the name of the Dexterity procedure, this must match your method name and dll.
    out long psierror; <-- These are the parms passed to the .dll
    in string szlicenseID;

    2.  Then set up a Dexerity procedure that calls the procedure defined in the previous step.  See the following example:

    {gfPsiActivate60DayTrial}
    local long l_psierror;
    warning "The 60-day trial version of MARS is being activated.";
    extern 'PsiActivate60DayTrial@PSIKey.dll', l_psierror, "210323412";

    3.  Then call the procedure (gfPsiActivate60DayTrial) ... that calls the procedure (PsiActivate60DayTrial@PSIKey.dll ... that executes the .dll (PSIKey.dll) and runs the method (PsiActivate60DayTrial).

    In this example, the method titled PsiActivate60DayTrial in the .dll, PSIKey.dll is executed.


     

  • Mariano Gomez Profile Picture
    26,225 on at
    Re: Re: Re: calling dll from dexterity

    [quote user="Nilotpal Cho"]

    hi,

    thanks a lot for ur reply.

    But my problem is still there.

    Now,In VB2005 i have created a Dll (ETGP.dll) with the coding as,

    STEP1: 

    public class ETGP

      public function ETGP()

          Dim arr as string="hi"

          Return arr

      end function

    end class

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

    STEP2 

    Now in Dex i have created a script named as " ETGP@ETGP.dll " with the folowing code,

    out string msg;

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

    STEP3 

    Now, i am calling the Same script from other location as,

    extern 'ETGP@ETGP.dll',msg;

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

    i am getting the error as,

    Could not call external 'ETGP@ETGP.dll'

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

    I have included the dll under GAC and dexterity folder (from where i will be launching the Dexterity).

    i am working in (Dexterity)Clrl+t mode(deveopment mode of GP).

     

    [/quote]

    There is your problem. You cannot call an assembly directly from Dexterity. You will first have to make sure you register your assembly with COM, by creating the corresponding .tlb files for your assembly. Once this is in please you can use the Dexterity COM_CreateObject functions to instantiate your class and be able to call the methods in the class.

  • Nilotpal Cho Profile Picture
    255 on at
    Re: calling dll from dexterity

    i have registered a COM DLL as ,

    1)regasm ABC.dll

    2)regasm ABC.dll / regfile:ABC.reg

    3)regasm ABC.dll /tlb:ABC.tlb

    i want to call a function from the DLL to Dexterity .(same code in AX is given bellow)

    A dll is getting called in AX as,

    ------------------------------------------------------------------START---- 

    x=7; 

    dll winapidll=new dll("ABC.dll");

    dllfunction function=new dllfunction(WinApiDLL,'_Distributeamount@40');

    Function.args(extTypes::DWord,extTypes::String,extTypes::String,extTypes::String,extTypes::String,extTypes::Double,

                       extTypes::String,extTypes::String,extTypes::String );

    Function.returns(extTypes::DWord);

    x=Function.call(this.hwnd(),prm1,prm2,prm3,prm4,prm5,prm6,prm7,prm8);

    this.bold(1);

    return x;

    ---------------------END------------------

    Help me to solve this.

    regards,

    Nilotpal

  • Mariano Gomez Profile Picture
    26,225 on at
    Re: Re: calling dll from dexterity

    Nilo,

    Take a look at my article Building a COM Interop Assembly to use with Microsoft Dexterity for more information.

  • Nilotpal Cho Profile Picture
    255 on at
    Re: Re: Re: calling dll from dexterity

    hi Gomez, 

    thanks a lot my issue is solved.

     

    regards,

    Nilotpal

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics GP (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans