Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #12815 > unrolled thread

Linking to C++ DLL's

Started byRobert Pope <cooeee@gmail.com>
First post2020-01-31 03:42 -0800
Last post2020-02-01 11:12 +0100
Articles 5 — 3 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  Linking to C++ DLL's Robert Pope <cooeee@gmail.com> - 2020-01-31 03:42 -0800
    Re: Linking to C++ DLL's Robert Pope <cooeee@gmail.com> - 2020-01-31 04:01 -0800
    Re: Linking to C++ DLL's Robert Pope <cooeee@gmail.com> - 2020-01-31 04:17 -0800
      Re: Linking to C++ DLL's Robert van der Hulst <rjvanderhulst@gmail.com> - 2020-02-01 02:48 -0800
    Re: Linking to C++ DLL's "Wolfgang Riedmann" <wriedmann@gmail.com> - 2020-02-01 11:12 +0100

#12815 — Linking to C++ DLL's

FromRobert Pope <cooeee@gmail.com>
Date2020-01-31 03:42 -0800
SubjectLinking to C++ DLL's
Message-ID<e038c8a9-2225-4929-95e3-34f9226817e6@googlegroups.com>
Hi,

I'm trying to see if I can get my app to link to Google's RE2 regular expression library. I've obtained the source code and built the DLL file.

It appears to export all its entry points as C++ interfaces. I've not encountered a library implemented like this before, and I've not yet successfully managed to link it. For example, I want to use the FullMatchN method which appears to be a method of the RE2 class. Does VO support this type of linking, or do I need to write a C-style wrapper for it? 

One of my colleagues suggested it might be possible and gave the VO SDK as a reference: _DLL ACCESS FCount CLASS DbFileSpec:VO28RDD.DbFileSpec:FCount:Access

re2.h (I trimmed out a lot of stuff in the middle):
class RE2 {
 public:
  static bool FullMatchN(const StringPiece& text, const RE2& re,
                         const Arg* const args[], int n);


From Dependencies (DLL exploring tool):
public: static bool __cdecl re2::RE2::FullMatchN(class re2::StringPiece const &,class re2::RE2 const &,class re2::RE2::Arg const * const * const,int)

So far I've tried various combinations of the following, but none has worked yet (I know the parameters are incorrect. AFAIK I should still be able to link without fixing that):
_DLL FUNCTION Re2FullMatch(psztext AS PSZ, pszRe AS PSZ, pArray REF PTR) AS LOGIC PASCAL:RE2.RE2::FullMatchN

E.g.
RE2.FullMatchN
RE2.RE2:FullMatchN
RE2.RE2::FullMatchN
RE2.re2::RE2::FullMatchN

Cheers.

[toc] | [next] | [standalone]


#12816

FromRobert Pope <cooeee@gmail.com>
Date2020-01-31 04:01 -0800
Message-ID<7a51f1fa-6779-42c6-8cca-956eb5d88b44@googlegroups.com>
In reply to#12815
On Friday, January 31, 2020 at 10:42:48 PM UTC+11, Robert Pope wrote:
> Hi,
> 
> I'm trying to see if I can get my app to link to Google's RE2 regular expression library. I've obtained the source code and built the DLL file.
> 
> It appears to export all its entry points as C++ interfaces. I've not encountered a library implemented like this before, and I've not yet successfully managed to link it. For example, I want to use the FullMatchN method which appears to be a method of the RE2 class. Does VO support this type of linking, or do I need to write a C-style wrapper for it? 
> 
> One of my colleagues suggested it might be possible and gave the VO SDK as a reference: _DLL ACCESS FCount CLASS DbFileSpec:VO28RDD.DbFileSpec:FCount:Access
> 
> re2.h (I trimmed out a lot of stuff in the middle):
> class RE2 {
>  public:
>   static bool FullMatchN(const StringPiece& text, const RE2& re,
>                          const Arg* const args[], int n);
> 
> 
> From Dependencies (DLL exploring tool):
> public: static bool __cdecl re2::RE2::FullMatchN(class re2::StringPiece const &,class re2::RE2 const &,class re2::RE2::Arg const * const * const,int)
> 
> So far I've tried various combinations of the following, but none has worked yet (I know the parameters are incorrect. AFAIK I should still be able to link without fixing that):
> _DLL FUNCTION Re2FullMatch(psztext AS PSZ, pszRe AS PSZ, pArray REF PTR) AS LOGIC PASCAL:RE2.RE2::FullMatchN
> 
> E.g.
> RE2.FullMatchN
> RE2.RE2:FullMatchN
> RE2.RE2::FullMatchN
> RE2.re2::RE2::FullMatchN
> 
> Cheers.

I still don't have it working, but I was just playing with this syntax too after (based on DbFileSpec:Init in the SDK):

CLASS RE2

_DLL METHOD FullMatchN(psztext, pszRe, pArray, iVal) CLASS RE2:RE2.re2::RE2::FullMatchN

[toc] | [prev] | [next] | [standalone]


#12817

FromRobert Pope <cooeee@gmail.com>
Date2020-01-31 04:17 -0800
Message-ID<51c199e1-5365-4b2d-9a53-8d6a80eea63a@googlegroups.com>
In reply to#12815
On Friday, January 31, 2020 at 10:42:48 PM UTC+11, Robert Pope wrote:
> Hi,
> 
> I'm trying to see if I can get my app to link to Google's RE2 regular expression library. I've obtained the source code and built the DLL file.
> 
> It appears to export all its entry points as C++ interfaces. I've not encountered a library implemented like this before, and I've not yet successfully managed to link it. For example, I want to use the FullMatchN method which appears to be a method of the RE2 class. Does VO support this type of linking, or do I need to write a C-style wrapper for it? 
> 
> One of my colleagues suggested it might be possible and gave the VO SDK as a reference: _DLL ACCESS FCount CLASS DbFileSpec:VO28RDD.DbFileSpec:FCount:Access
> 
> re2.h (I trimmed out a lot of stuff in the middle):
> class RE2 {
>  public:
>   static bool FullMatchN(const StringPiece& text, const RE2& re,
>                          const Arg* const args[], int n);
> 
> 
> From Dependencies (DLL exploring tool):
> public: static bool __cdecl re2::RE2::FullMatchN(class re2::StringPiece const &,class re2::RE2 const &,class re2::RE2::Arg const * const * const,int)
> 
> So far I've tried various combinations of the following, but none has worked yet (I know the parameters are incorrect. AFAIK I should still be able to link without fixing that):
> _DLL FUNCTION Re2FullMatch(psztext AS PSZ, pszRe AS PSZ, pArray REF PTR) AS LOGIC PASCAL:RE2.RE2::FullMatchN
> 
> E.g.
> RE2.FullMatchN
> RE2.RE2:FullMatchN
> RE2.RE2::FullMatchN
> RE2.re2::RE2::FullMatchN
> 
> Cheers.

I managed to get my app to start without getting the "Unable to find entry point" error. I haven't got it working yet, but I've jumped one hurdle.

This thread helped me: https://groups.google.com/d/msg/comp.lang.clipper.visual-objects/5Z22PyfZNPI/EM25AtkCBAAJ

I had to use this syntax: _DLL METHOD FullMatchN(psztext, pszRe, pArray, iVal) CLASS RE2:re2.?FullMatchN@RE2@re2@@SA_NABVStringPiece@2@ABV12@QBQBVArg@12@H@Z

[toc] | [prev] | [next] | [standalone]


#12822

FromRobert van der Hulst <rjvanderhulst@gmail.com>
Date2020-02-01 02:48 -0800
Message-ID<a77aea62-139e-437a-b168-1112ebf4ebfb@googlegroups.com>
In reply to#12817
Robert

> I had to use this syntax: _DLL METHOD FullMatchN(psztext, pszRe, pArray, iVal) CLASS RE2:re2.?FullMatchN@RE2@re2@@SA_NABVStringPiece@2@ABV12@QBQBVArg@12@H@Z

This is the way to start implementing it but it is far from complete. You also have to specify the calling convention to let the compiler know how to pass the "SELF" variable from your code to the C++ DLL and who is responsible for cleaning up the stack after you call the method. And you also need to specify the parameter types for psztext, pszRe etc. Without that the compiler will assume that you are passing usuals and I am sure that the C++ DLL will not understand that.
If you are not familiar with how things are working under the hood (both in VO and in C++) that I would advise you to not use this
So I agree with Wolfgang that there are better solutions.

Robert

[toc] | [prev] | [next] | [standalone]


#12821

From"Wolfgang Riedmann" <wriedmann@gmail.com>
Date2020-02-01 11:12 +0100
Message-ID<h9l197F1rlvU1@mid.individual.net>
In reply to#12815
Hi Robert,

you should try the C# way if possible and then use COM to integrate the
lib into you VO application.

Many years ago there was an article how to integrate a C++ library in
VO, but if I remember correctly it was really complicated.

Wolfgang

Robert Pope wrote:

> Hi,
> 
> I'm trying to see if I can get my app to link to Google's RE2 regular
> expression library. I've obtained the source code and built the DLL
> file.
> 
> It appears to export all its entry points as C++ interfaces. I've not
> encountered a library implemented like this before, and I've not yet
> successfully managed to link it. For example, I want to use the
> FullMatchN method which appears to be a method of the RE2 class. Does
> VO support this type of linking, or do I need to write a C-style
> wrapper for it?
> 
> One of my colleagues suggested it might be possible and gave the VO
> SDK as a reference: _DLL ACCESS FCount CLASS
> DbFileSpec:VO28RDD.DbFileSpec:FCount:Access
> 
> re2.h (I trimmed out a lot of stuff in the middle):
> class RE2 {
>  public:
>   static bool FullMatchN(const StringPiece& text, const RE2& re,
>                          const Arg* const args[], int n);
> 
> 
> From Dependencies (DLL exploring tool):
> public: static bool __cdecl re2::RE2::FullMatchN(class
> re2::StringPiece const &,class re2::RE2 const &,class re2::RE2::Arg
> const * const * const,int)
> 
> So far I've tried various combinations of the following, but none has
> worked yet (I know the parameters are incorrect. AFAIK I should still
> be able to link without fixing that):  _DLL FUNCTION
> Re2FullMatch(psztext AS PSZ, pszRe AS PSZ, pArray REF PTR) AS LOGIC
> PASCAL:RE2.RE2::FullMatchN
> 
> E.g.
> RE2.FullMatchN
> RE2.RE2:FullMatchN
> RE2.RE2::FullMatchN
> RE2.re2::RE2::FullMatchN
> 
> Cheers.



-- 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web