Solved

Using .Net dll insinde powerbuilder code

Posted on 2004-10-11
4
763 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Tomcat6 in eclipse 2 39
Adding ribbon in custom Tab in word 2007 using VBA editor 10 65
Multi Line / Multi file editor 6 68
eclipse formatting 6 70
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: …
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand columnThat will then direct you to their download page.From that page s…
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.

930 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

10 Experts available now in Live!

Get 1:1 Help Now