Using Borland C DLL in PowerBuilder 10

We tested the new PowerBuilder10 beta version.
Before we used PowerBuilder 6. In PowerBuilder 10 our DLL
functions didn't work. The same functions are working with
PowerBuilder 6.
After PowerBuilder10 has handed over a String to the C
function, the length of the String in the C function
(strlen(s)) is always 1 and the C function always returns
only the first character of the string.

This Example returns a "0" to PowerBuilder10 but it must be
"040170000001":

Defintion of the external function in PB:
public function string  CDelete(string s,string t) Library
"etc.dll"

invoking the function in PB:
this.text=lib.CDelete("04-017000-001","-")

The Borland C function:
extern "C" LPSTR __stdcall __export
CDelete( LPSTR s, LPSTR t){
   if (s==((void *)0))return 0;
   if (t==((void *)0))return s;
    long i,j,i1,j1,ls,lt;

    ls=strlen(s);if(ls<1)return "";
    lt=strlen(t);if(lt<1)return s;
    for(i=0,j=0;i<ls;){
      if(s[i]==t[0]){
         i1=i;j1=0;
         while(s[++i1]==t[++j1] && i1<ls && j1<lt);
         if(t[j1]==0){i+=lt;continue;}
         }
      s[j++]=s[i++];
      }
s[j]=0;
  MessageBox(NULL,s,"s",MB_OK);
return s;
}
0
tkr
1/28/2004 9:14:18 AM
sybase.powerscript 7704 articles. 0 followers. Follow

2 Replies
700 Views

Similar Articles

[PageSpeed] 41

You need to post questions concerning the beta in the beta newsgroup.

Keep in mind, however, that PB10 is UNICODE, whereas PB6 is ANSI.

On 28 Jan 2004 01:14:18 -0800, tkr wrote:

>We tested the new PowerBuilder10 beta version.
>Before we used PowerBuilder 6. In PowerBuilder 10 our DLL
>functions didn't work. The same functions are working with
>PowerBuilder 6.
>After PowerBuilder10 has handed over a String to the C
>function, the length of the String in the C function
>(strlen(s)) is always 1 and the C function always returns
>only the first character of the string.
>
>This Example returns a "0" to PowerBuilder10 but it must be
>"040170000001":
>
>Defintion of the external function in PB:
>public function string  CDelete(string s,string t) Library
>"etc.dll"
>
>invoking the function in PB:
>this.text=lib.CDelete("04-017000-001","-")
>
>The Borland C function:
>extern "C" LPSTR __stdcall __export
>CDelete( LPSTR s, LPSTR t){
>   if (s==((void *)0))return 0;
>   if (t==((void *)0))return s;
>    long i,j,i1,j1,ls,lt;
>
>    ls=strlen(s);if(ls<1)return "";
>    lt=strlen(t);if(lt<1)return s;
>    for(i=0,j=0;i<ls;){
>      if(s[i]==t[0]){
>         i1=i;j1=0;
>         while(s[++i1]==t[++j1] && i1<ls && j1<lt);
>         if(t[j1]==0){i+=lt;continue;}
>         }
>      s[j++]=s[i++];
>      }
>s[j]=0;
>  MessageBox(NULL,s,"s",MB_OK);
>return s;
>}

Bruce Armstrong [TeamSybase]
http://www.teamsybase.com

Sixth Annual Sybase Tools Seminar - April 19 - Minneapolis, MN
http://www.powerobjects.com/seminar/?source=newsgroups

Two new books on developing with PowerBuilder
http://www.pb9books.com?source=newsgroups

Need code sample?  Check out CodeXchange:
http://www.codexchange.sybase.com

ISUG Enhancement Requests
http://www.isug.com/cgi-bin/ISUG2/submit_enhancement

Preach the gospel at all times. If necessary, use words. - Francis of Assisi
http://www.needhim.org
0
Bruce
1/28/2004 3:34:14 PM
This is probably because your DLL is expecting ANSI strings, and PB is
supplying Unicode strings.


<tkr> wrote in message news:40177fc4.47e7.846930886@sybase.com...
> We tested the new PowerBuilder10 beta version.
> Before we used PowerBuilder 6. In PowerBuilder 10 our DLL
> functions didn't work. The same functions are working with
> PowerBuilder 6.
> After PowerBuilder10 has handed over a String to the C
> function, the length of the String in the C function
> (strlen(s)) is always 1 and the C function always returns
> only the first character of the string.
>
> This Example returns a "0" to PowerBuilder10 but it must be
> "040170000001":
>
> Defintion of the external function in PB:
> public function string  CDelete(string s,string t) Library
> "etc.dll"
>
> invoking the function in PB:
> this.text=lib.CDelete("04-017000-001","-")
>
> The Borland C function:
> extern "C" LPSTR __stdcall __export
> CDelete( LPSTR s, LPSTR t){
>    if (s==((void *)0))return 0;
>    if (t==((void *)0))return s;
>     long i,j,i1,j1,ls,lt;
>
>     ls=strlen(s);if(ls<1)return "";
>     lt=strlen(t);if(lt<1)return s;
>     for(i=0,j=0;i<ls;){
>       if(s[i]==t[0]){
>          i1=i;j1=0;
>          while(s[++i1]==t[++j1] && i1<ls && j1<lt);
>          if(t[j1]==0){i+=lt;continue;}
>          }
>       s[j++]=s[i++];
>       }
> s[j]=0;
>   MessageBox(NULL,s,"s",MB_OK);
> return s;
> }


0
Mark
2/2/2004 9:16:25 PM
Reply:

Similar Artilces:

Use PowerBuilder DLL in PowerBuilder
We use PB6.5. We would want to use a DLL create from PB in a PB application. We compiled an a PBL as DLL. After we tried to use DLL in a user object external, but without success. How can we do to use DLL create from PB or use in a new PB application some object (visual and no) before compiled with PB? Any help will be appreciated. Saul.Convalle@mail.cec.it Thanks When you create a DLL from a PB library it is not really a standard Windows DLL. I'm not sure what the difference is. If you are making calls from PB then just use the standard PB calling syntax the ...

Calling C# .Net dll From Powerbuilder 10.0
I am in a major time crunch here and really need some HELP!! I am calling a LDAP class for user authentication from Powerbuilder. When I run it from my PC everything works fine, of course because I'm doing all of the development. When I run it from a PC that does not have PB or .Net framework loaded the PB application can not create the object. Please tell me that I don't need the .Net Framework loaded on all of the user's PC's?? They are running the PB application from a Network share. The create object is return -3. Any help is much appreciated. This is my code: ...

Using a third party DLL in Powerbuilder 10.2
I have a third party dll that I am trying to use in a Powerbuilder app, the dll has an object library with 4 objects, these objects have methods (functions) that I would like to call. The one I am trying to call is Data.Connect(MDBName As String, blnSilent As Boolean). I have Declared a global external function "FUNCTION boolean DataConnect1(string ls_DBPath, boolean lb_error) LIBRARY "IDNImageNetSDK.dll" ALIAS FOR "Data.Connect"" and have tried to call it "lb_connect = Data(ls_DbPath, lb_error)" but get an error, "error calling ex...

DLL Library in Watcom C++ for PowerBuilder 10.x
In PowerBuilder 6.5 we used to work with Watcom to edit a DLL source written in C++. How can it be done in PowerBuilder 10.x ? How can we edit the DLL source written in C++ using PowerBuilder 10.x? Which are the steps ? What are the requisites? Check into PBNI. The help file should be in: C:\Program Files\Sybase\PowerBuilder 10.0\SDK\PBNI The C++ code has to be developed in a separate C development tool, MS Visual Studio for example. <faencaro> wrote in message news:4a8ebe1b.4401.1681692777@sybase.com... > In PowerBuilder 6.5 we used to work with Watcom to edit a ...

Using Borland C++ & Codeguard for DLL memory leaks
Has anyone used Borland C++ 5.0+ and Codeguard to detect memory leaks in a DLL built with Borland C++ that is called from PowerBuilder 5.0.03? Application starts but we get a messagebox saying "Cannot write to logfile/ Disk full??" You can E-mail me at the address below. Thanks in advance, CS -- chuck.siebsen@damark.com ...

using c# generated dll inside powerbuilder 11.5
HI there BAckground> I building my dll inside c# in VS2010 using .net 2.0. I would like to use this simple dll which gets Outlook data from the clipboard and generates a file inside my powerbuilder application. So nothing too fancy. Please help. I have seen some examples of how this should work, but having followed a lot of them i still can not get this to do the job. Basically I created a simple c# class and I have the dll. IN the options I set cominterop and under the namespace in the class I entered > [ComVisible(true)] [ClassInterface(ClassInterfaceTy...

How do I call a com dll written in c++ using PowerBuilder 6.5???
Environment : Win Nt Wks 4.0 SP4 PowerBuilder 6.5 hi, I have written a com dll using c++ (ATL dev studio 6.0) and I now have to call the dll form a powerbuilder app. How do I call my com dll from my powerbuilder app??? Thanks Sunit On Tue, 9 Feb 1999 20:37:50 -0600, "Senna" <puto@execpc.com> wrote: I believe you use the ConnectToNewRemoteObject function to do this. You will have to make sure your COM object is registered, however. HTH Jon Credit[TeamPS] CPD Professional PB6 JCredit@Sprynet.com http://home.sprynet.com/sprynet/jcredit >E...

Using C# managed DLL from PBNI DLL
Can any one help me with an example of how to use a C# dll in an PBNI dll? I have tried to look at the PB2DOTNET.dll on code exchange but there is no source code this dll. TIA Thomas Bodell I just got the source code from Roy and updated the sample on CodeXchange. Try that latest version. "Thomas Bodell" <thomas@monitor.se> wrote in message news:439d78d5$1@forums-2-dub... > Can any one help me with an example of how to use a C# dll in an PBNI dll? > I have tried to look at the PB2DOTNET.dll on code exchange but there is no > source code this...

how Can I use my DLL made by Dev-C++ in C++builder2009?
How Can I use the functions of my DLL made by Dev-C++ in C++builder2009. Will come specifications be performed? Can any one give me some examples? Can anyone with kindness help me? <lserjt lserjt> wrote in message news:137185@forums.codegear.com... > How Can I use the functions of my DLL made by Dev-C++ in C++builder2009. Assuming you already have a .h header file for the DLL (that does not require tweaking), use BCB's command-line IMPLIB.EXE tool to generate a BCB-compatible .lib import file and add it to your project. Then you can #include the .h file in your co...

Newbie Question: Import C++ DLL and using it in a C++.NET Project
Hi, I am using Microsoft Visual Studio 2005. I am trying to create a C++ application (Win32 project/application) that imports functions from a DLL. The DLL, which I did not create, is a Win32 DLL (that uses MFC in a static library). The DLL .h and .cpp files do not contain any classes. Just functions with __declspec (dllexport).  I think that my problem is that I am very new  to .NET (I am not sure I should post this question in a different form[:'(]). Here is what I have done:I tried creating a new solution and adding the DLL project to it and then building the project (to gen...

Using a C# dll
I have a dll constructed in C# and I need to call a function in it. I tried to declare the dll how a external funcion but when I call the function I obtained "Error calling external function". How I can use it? Regards, jorge. If you are deploying as a PBDOTNET app, you can import references to assemblies in the target properties. Then use #IF defined PBDOTNET THEN conditional compile directive. See HTML books. "jpavan" <jorge.pavan@gmail.com> wrote in message news:a6853410-6664-4212-9828-828d62364bc3@h2g2000vbd.googlegroups.com.....

dll(Class Library) files used in asp.net2.0 using C#
hello sir, I want to create a class called "Calculator" having function " Add,    substract,      divide and     multiply" and want to make it dll file and want to use in my .aspx page . please tell me how to do that application using C# language thank you. All you have to do is to create a reference from your webproject to the DLL file. create a window class library type project add a class.cs page define all your methods there and build it in release mode. now you will get the dll in the bin...

How can I write a DLL in PowerBuilder which exports functions to be called in C/C++ code?
Hi, all. I want to write some business logic functions in PowerBuilder which will be called in another c/c++ program. How can I do this? Thanks & Best Regards. Feng You can't create standard Win32 DLLs in PowerBuilder. You can, however, compile NVOs into COM DLLs, and call those from a C++ program. -- <hopethishelps /> Roy Kiesler [TeamSybase] MySybase - http://my.sybase.com "Feng Zhu" <fzhu@sumerp.com> wrote in message news:tAzUZI7aAHA.216@forums.sybase.com... > Hi, all. > > I want to write some business logic functions...

Help me start setting up very old Borland C++ project using C++ Builder
Hi, I am very new to this both C++ and C++ Builder community. My questions may sound silly but they are not to me. I have been assigned to modify a very old project with the code library. I do not have any system/builder information like what compiler and interfaces or any third party assemblies this project incorporated with. All I have is the list of .cpp, .dfm, .obj and .h files. By this list I assumed this project should have been compiled in C++ compiler. So I have downloaded the free Borland C++ compiler and installed it. After setting up the compiler I did try compiling my pro...

Web resources about - Using Borland C DLL in PowerBuilder 10 - sybase.powerscript

PowerBuilder - Wikipedia, the free encyclopedia
PowerBuilder is an integrated development environment owned by Sybase , a division of SAP . It has been in use since 1991, peaking around 1998 ...

Sybase PowerBuilder tool readied for Microsoft's .Net
... Win32 or newer style .Net development After several years of work, Sybase is ready to deliver on the final step in its plan to move PowerBuilder ...

Jim O'Neil (@jimoneil) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Open Directory - Computers: Programming: Languages
about dmoz - dmoz blog - report abuse/spam - help the entire directory only in Programming/Languages Description Top : Computers : Programming ...

The HP Booth Staff (Goons) Owe Me an Apology
... when you might need to use it. For instance, when I was in the WinRunner world there were plugins for driving terminal emulators and powerbuilder ...

Contact Us - Sybase Inc
Thanks for visiting the 主页 section of Sybase.com. Here you will find information about Contact Us. For more information about Business Intelligence, ...

热门搜索 - 我的异常网
... 我的异常网 » 热门搜索 sdpnet2 移动【A111】其它用户原因鉴权失败,是什么意思啊 http:// 192.168.1.102:22578 本网站服务器位于美国,受美国法律保护 MiniUI js 破解 http://192.168.1.103:8080/ powerbuilder ...

Mobile app security: Always keep the back door locked
The best way to keep mobile apps safe is to secure the services they connect to.

10 Tech Skills That Will Instantly Net You A $100,000+ Salary
... that let's developers run Java applications. Java is highly popular language for writing web apps and custom enterprise apps. No. 8: PowerBuilder ...

Top Ranked Articles
Top Ranked Articles - Free source code and tutorials for Software developers and Architects.; Updated: 23 Feb 2013

Resources last updated: 12/6/2015 12:35:28 PM