Results 1 to 8 of 8

Thread: Using DLL

  1. #1
    Senior Member
    Join Date
    Feb 2012
    Location
    Rome - Italy
    Posts
    1,893

    Using DLL

    Hi all,
    I'm working on Windows machine and I need to use an external DLL written with c#

    this is a sample code from x++:

    Code:
        connector = new Cegeka.AX.IXFE.Connector(); // this is the DLL
        connector.initByAooName(parameters.ServiceURL, parameters.ServiceUser, parameters.ServicePassword, parameters.Aoo);
    then
    Code:
            request = new Cegeka.AX.IXFE.SendInvoiceRequest();
            request.set_Filename(filename);
            request.set_Mode(Cegeka.AX.IXFE.SendMode::XMLString);
            request.set_XmlString(eInvoice.XMLOutgoing);
    
            invoicePrintingAsByteArray = this.getInvoicePrintingAsByteArray(eInvoice);
    
            response = connector.sendInvoice(request);
    how can I do with Lianja?
    Is possible?

    Thanks
    Fabio

  2. #2
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    2,185
    Hi Phabio,

    looking ahead with Lianja on the roadmap, .Net Core will be integrated some time in the future.

    At present, if I were in your position I would see two options:

    1) wrap the .Net library with wwDotNetBridge form westwind.com, in VFP, make that into a VfP COM object, and access the COM object as an ActiveX control. A lot of learning there if you haven't already done so.

    2) the better way: find out the web API that this dll is accessing, and using Chilkat HTTP control (because you will likely need some security features that Chllkat makes quite easy, plus their error reporting will save a lot of work during testing), write/read from the web interface. This reference should get you started: https://social.technet.microsoft.com...t-web-api.aspx Once you find the real documents with the web calls it should be easier than it looks.

    Hank

  3. #3
    Senior Member
    Join Date
    Feb 2012
    Location
    Rome - Italy
    Posts
    1,893
    Wow, not easy for me...

    thanks
    Fabio

  4. #4
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    2,185
    Hi Phabio,

    yes, but the web api stuff has a lot of applicability. My first XML one was painful, as they used non-standard escape sequences. And I hadn't done it before. It's still in production, 7 or 8 years later.

    It gets easier -- so long as there is either decent documentation or sample apps from which you can figure out what to do, even it it's in a different development language.

    Good luck,

    Hank

  5. #5
    Senior Member
    Join Date
    Feb 2012
    Location
    Rome - Italy
    Posts
    1,893
    Thanks Hank,
    but wut with Lianja, I do not call a DLL?

    I have a DLL already written by a colleague of mine that sends the XML file. I should just recall this DLL, passing a few parameters.

  6. #6
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    2,185
    Hi Phabio,

    What you described is a .Net DLL. AX is of course written in .Net. No, you cannot call a .Net DLL from a non-.Net application. Search for "VFP call .Net DLL" if you want more confirmation.

    AX has a web API, which is the good news. That is how non-.Net applications interact with AX.

    Did your colleague write this DLL? If so, you should be able to, from windows CMD with Admin privileges, issue:

    c:\windows\syswow64\regsvr32 <put pathed dll here>

    If it succeeds, then yes, you can just do a createobj() with the class name of the dll. If it's a .Net DLL you will get a message that's there's no entry point.

    Hank
    Last edited by HankFay; 2019-01-17 at 09:59.

  7. #7
    Lianja MVP
    Join Date
    Dec 2012
    Location
    Croatia, Zagreb
    Posts
    1,135
    Hi Fabio,

    Here is a post about ".NET COM in Lianja - Workaround"

    https://www.lianja.com/community/sho...nja-Workaround

    Josip

  8. #8
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    2,185
    I see that Rick Strahl has open-sourced wwDotNetBridge under the MIT license. https://github.com/RickStrahl/wwDotnetBridge

    A quick look at the VFP prg, wwDotNetBridge.prg, looks to have very little that wouldn't run in Lianja, and perhaps all of it might.

    What this does is allow access to .Net DLL's that haven't been made comvisible. Anyway, it's actually easier than I remembered.

    Hank

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us