[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 667
  • Last Modified:

How to create a dll in PB?

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!!
  • 3
  • 2
2 Solutions
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
Check the articles on PowerBuilder Native Interface (PBNI)  by Roy Kiesler
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?

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 @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.
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.
tsirakuaAuthor Commented:
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!

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now