Solved

How to create a dll in PB?

Posted on 2004-10-28
622 Views
Last Modified: 2013-12-26
Hi!
I need to create a dll with some functions than I already have like encrypt a string and things like that.
How can I create the dll with these functions to be called from a program in another lenguage like delphi or from the same PB? wich are the steps? I'm using PB 9.0
Thank you very much!!
0
Question by:tsirakua
    6 Comments
     
    LVL 5

    Accepted Solution

    by:
    You'd need to use PBNI to call PB functions, but that gets you into a whole other world.  

    It would be easier to write the utility functions in another language like Delphi or C which creates true windows dlls and call them from PB
    0
     
    LVL 33

    Assisted Solution

    by:sajuks
    Check the articles on PowerBuilder Native Interface (PBNI)  by Roy Kiesler
    http://www.sys-con.com/pbdj/article.cfm?id=504
    0
     
    LVL 5

    Expert Comment

    by:michaelstoffel
    My feel is that if you need to go to that amount of effort (PBNI) it would be more cost effective to write encryption routines, etc. in a language that creates actual Windows DLLs.  PowerBuilder is much less efficient at string manipulation than Delphi anyway.  And take a look at what you have to go through to call a PB function from another language and I'm sure you'll agree it's easier to go the other language route.

    If you already have expertise in another language, which I assume you do since you want to use Delphi to access the functions, it makes more sense to just use that language.

    What is the rationale for using PB in this situation?

    Mike
    0
     
    LVL 33

    Expert Comment

    by:sajuks
    <offtopic>
     @michaelstoffel,no offense, but dont you think that if you are a hardcore powerbuilder program
    and you have been now given the right tool and facility to be allowed to create/access dlls which
    can be used in any other language a great advantage? True if you know Delphi,C then you would most
    probably create them in that language but if are programming in pb and they've a simple to use interface
    then why not code in that pb itself ?Since Pb9 and above offers lots of new things which were not available
    uptil now in PB you'd to look at other options and combine PB and C/Delphi together in your programming s/w.
    But now it has become much simpler, the learning curve now stops at PB itself(for a novice programmer) .
    But thats my opinion and others may disagree. Am not against delphi/c am hust commenting upon the fact that since pb now
    offers all these things do you still need to code a part of your s/w in other languages .
    Again i offer my apology if you feel i've offended you in some way.
    </offtopic>
    0
     
    LVL 5

    Expert Comment

    by:michaelstoffel
    I'm not offended at all.  And yes I'm a die hard PB user, have been since version 2.  But PB is not the best tool for all instances.  For something as simple as an encryption function, the effort to call the function from Delphi or C using PBNI would be way more expensive than just recoding the function.  

    To me it is more a question of cost justification.  If the goal is to code some utilities once that are callable from multiple languages, then it may make sense not to use PB.  It's up to tsirakua to take the information we've provided here, do a little research, and make a decision as to the most effective way to approach the problem.  There is no right answer.

    BTW, to use PBNI, you must code in C++, as well as in PB, so you are already out of the PB only realm.

    I think discussions like these are good and differing opinions cause both side to think.  I also hope I have not caused any offense.
    0
     

    Author Comment

    by:tsirakua
    Guys thank you very much for your interest!
    I´m a PB programmer and I have not very much experience programming in delphi, the reason to programm the dll in PB is because I have more experience programming in PB but I'm part of a team of programmers than programms in different lenguages like delphi and C and I have the work to program the dll to all the team use it, but after your help I decided to programm the dll en delphi with help of my partners.
    Thank you guys!
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
    Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
    THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
    The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

    877 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now