Solved

Using .Net dll insinde powerbuilder code

Posted on 2004-10-11
4
762 Views
Last Modified: 2013-12-26
Hi,

I'm totally new in powerbuilder development and I try to access to one of my .Net dll
The final objective is to access to an active directory to perform the user authentication.
I already code something using the EJB code over an EAServer provided by Sybase but I don’t want to use an EAServer just for that.
The idea is where do I need to put my dll to access it from powerbuilder.
I actually use the version 9 of PB and the dll is coded in VB .NET and with the version 1.1 of the .NET framework.

Thanks.
0
Comment
Question by:lcomes
  • 2
  • 2
4 Comments
 
LVL 18

Expert Comment

by:diasroshan
ID: 12279117
HI,

what u need to do is declare a 'Global External Function'...

i will give u an example...

first declare the dll as an global external function....
u can do this in the declare section of variable where one of the options is 'Global External Function'

write code as below in the variable declare section...
Function boolean GetUserNameA( ref string userID, ref ulong len ) library "ADVAPI32.DLL"


now in the code where u need to call it just call the function as ...

GetUserNameA(ls_userid,ll_len)

This should work...

Let me know if u need more assistance...

Cheers,
Rosh
0
 

Author Comment

by:lcomes
ID: 12279244
Hi,

Here is what I did :

In the 'Global External Function' declare part I put :

Private Function string testLDAP () Library "LDAPTool.dll" Alias For "test"
 and I call the function like that :

string test
test = testLDAP()

and I get an beautifull bad runtime function exception R0021.

I already use external function to call Windows API as you suggest in you code but actually, I try to do the same task with a custom API coded in VB .NET

I have no idea if there is something "new" to do because of that or if this kind of call are compatible with .Net managed code.

If you have any suggestion I'll really appreciate it

M.

0
 
LVL 18

Accepted Solution

by:
diasroshan earned 500 total points
ID: 12300929
hi,

try declaring ur function as follows...
Function string testLDAP () Library "LDAPTool.dll"

and i hope 'testLDAP()' is a function in ur dll...

well i have used dlls created in VC++ and i use it as above and it works fine...

Try it as above and let me know...

Cheer,
Rosh


0
 

Author Comment

by:lcomes
ID: 12308167
Thanks but it still not working, sounds like external function are not compatible with .NEt managed code.
I don't have the time to develop a wrapper. So, I've decided to use integrated login.
But Thank you for your answers.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

747 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

16 Experts available now in Live!

Get 1:1 Help Now