Re: [fpc-pascal] How to call C++ function with Vector

2017-09-26 Thread leledumbo via fpc-pascal
> I thought FPC had the ability to execute a fragment of Lua, and Lua I
believe can call C++ directly. 

No, Lua can only call C, just like FPC. You do know the problem of C++
interfacing, don't you?



--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] How to call C++ function with Vector

2017-09-26 Thread Mark Morgan Lloyd

On 26/09/17 19:00, leledumbo via fpc-pascal wrote:

Would it be possible to do this via a Lua shim?

How is it even related with that?


I thought FPC had the ability to execute a fragment of Lua, and Lua I 
believe can call C++ directly.


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] How to call C++ function with Vector

2017-09-26 Thread leledumbo via fpc-pascal
> Would it be possible to do this via a Lua shim?

How is it even related with that?



--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] PTCGraph: Monitor, Orientation and Size Selection

2017-09-26 Thread James Richters
I have a system with 3 Monitors, 2 Horizontal 1920x1200 and 1 Vertical 1200 x 
1920.  I'm wondering if there is a way to specify which monitor my program 
using  PTCGraph will run on.   I can make it run on a particular monitor by 
changing it to the main display, but it would be nice to leave that alone and 
still run my program on any monitor.   I'm using a Windows 10 64bit machine.  
Is there / could there be a way to specify which monitor by the monitor 
identification number in display settings?

Also I noticed I cannot run vertical resolutions on a horizontal monitor or 
horizontal resolutions on a vertical monitor, in a window... so I can't specify 
a 768x1024 window on a horizontal monitor or 1024x768 window on a vertical 
monitor, even though either would fit. 

I'm also curious if there is a way to make an odd size window,  like 1000x300 
or something that is totally not a standard resolution.  

Are there ways of doing these things that I just am not aware of?

Thanks

James

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] How to call C++ function with Vector

2017-09-26 Thread Dennis Poon



Marco van de Voort wrote:


I myself generally solve this with a wrapper DLL, by crafting a DLL in C++
that exports a C (not C++) interface, and then use that. The same method as
QT is used from Lazarus (via wrapper dll/.so qtpas)
___

Thanks.  I think I will follow your advice.

Dennis

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] How to call C++ function with Vector

2017-09-26 Thread Mark Morgan Lloyd

On 26/09/17 11:00, leledumbo via fpc-pascal wrote:

I am stuck at the keyword vector. >> How is it translated into free pascal?

It's hard, you must create additional wrapper that exposes simpler type(pointer 
or array of pchar) OR make wrapper for the vector methods andsimply declare it 
as an opaque pointer. std::vector is template/generic C++class that implements 
a dynamic array functionality, but it can't be usedoutside C++.


Would it be possible to do this via a Lua shim?

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] How to call C++ function with Vector

2017-09-26 Thread Marco van de Voort
In our previous episode, Dennis said:
> I have a windows 32-bit dll written in C++ (probably C++ Builder).
> It has 1 function which I need to call:
> 
> int SPAPI_GetProduct(vector& apiProdList)
> 
> I am stuck at the keyword vector.

It is not a keyword it is a generic type. So that is not easy, specially
since C++ and Pascal classes differ.

And even if the call succeeds, getting results from apiprodlist is major
problem number two.

You can try to match the C++ code with carefully crafted pascal code, but
that requires knowledge about implementation details of the C++
implementaton.

I avoided that way (as too complicated and too fragile), but Rudy Velthuis
has an article on it (C++ <-> Delphi)
http://www.rvelthuis.de/articles/articles-cppobjs.html

I myself generally solve this with a wrapper DLL, by crafting a DLL in C++
that exports a C (not C++) interface, and then use that. The same method as
QT is used from Lazarus (via wrapper dll/.so qtpas)
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] How to call C++ function with Vector

2017-09-26 Thread leledumbo via fpc-pascal
> I am stuck at the keyword vector. 
>
> How is it translated into free pascal?

It's hard, you must create additional wrapper that exposes simpler type
(pointer or array of pchar) OR make wrapper for the vector methods and
simply declare it as an opaque pointer. std::vector is template/generic C++
class that implements a dynamic array functionality, but it can't be used
outside C++.



--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] How to call C++ function with Vector

2017-09-26 Thread Dennis

I have a windows 32-bit dll written in C++ (probably C++ Builder).
It has 1 function which I need to call:

int SPAPI_GetProduct(vector& apiProdList)

I am stuck at the keyword vector.

How is it translated into free pascal?

Is the following correct?

type
   TSPApiProduct_Array = array of SPApiProduct;

function SPAPI_GetProduct(var apiProdList : TSPApiProduct);stdcall;

Thanks a lot in advance.

Dennis
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal