Calling a VB dll from within PowerBuilder

I have Created DLL using VB 6.0 which return the name string. Contains 1 parameter, which query and return the name. i have defined in PB as.

FUNCTION STRING GetName(STRING userid ) LIBRARY "Dbinterface.dll"

In VB it works fine.

im calling in PB as.

STRING nm
nm = GetName("IMTIYAZ")
messagebox("",nm)

When PB application is executed it gives an error.
Power Builder Application Error: (R0021)
Err: bad runtime funtion at line 62 ..
where line 62 contains the above codes.

Please, help me if anyone is aware of how to use VB dll in PB.

Thanking you in advance
rgds
Imtiyaz

wellwisher888Asked:
Who is Participating?
 
DaniProCommented:
I'm afraid but PB can call only DLL compiled in "FAR PASCAL" mode and VB6 can't create this type of DLL.
You have two solutions:
Create the dll with C++;
Create an OCX with VB6 instead of DLL
0
 
Vikas_DixitCommented:
If you have quickview or any other utility to see the exported function from dll, please confirm that the dll exports the function you are trying to call exports the function GetName?
0
 
srikanth_aCommented:
Try giving an alias to the function in your declaration.

Also please check where (scope)  have you declared the function.


Srikanth
0
 
BenClarkCommented:
You can't do it.
VB 6 creates ActiveX DLLs
You can use CreateObject() for the DLL.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.