Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing compilation conditionals #13

Closed
cpicanco opened this issue Mar 20, 2015 · 9 comments
Closed

Missing compilation conditionals #13

cpicanco opened this issue Mar 20, 2015 · 9 comments

Comments

@cpicanco
Copy link
Contributor

Hi everyone,

Is there any chance I get some help to fork this binding to use it with linux and lazarus?

Best
Rafael

@bvarga
Copy link
Owner

bvarga commented Mar 20, 2015

Hello,

What have you tried? try running the tests, there's a project file in the tests folder.

regards
Balazs

@cpicanco
Copy link
Contributor Author

I will try again and will document the process this time. :)

@cpicanco
Copy link
Contributor Author

The current version of the binding should work with fpc 2.6.0, but i will give a try with the 2.6.4.

OS: Crunchbang 11 (rip) / debian stable
zmq_version = 2.2.0 -> [zeromq-2.2.0.tar.gz](http://download.zeromq.org/)
Lazarus 1.2.6
Free Pascal Compiler version 2.6.4 [2014/04/20] for x86_64
  1. clone the repository
git clone https://github.com/cpicanco/delphizmq.git
  1. open fpctests.lpi

  2. undefine zmq3 in zmq.inc:

//{$define zmq3}

{$ifdef fpc}
  {$packset 1}
{$endif}                    
  1. Trying to compile "out of the box" stucks in some errors with zmqapi.pas:
/home/rafael/git/delphizmq/zmqapi.pas(2618,15) Error: Identifier not found "zmq_proxy"
/home/rafael/git/delphizmq/zmqapi.pas(2698,27) Error: Identifier not found "GenerateConsoleCtrlEvent"
/home/rafael/git/delphizmq/zmqapi.pas(2698,41) Error: Identifier not found "CTRL_C_EVENT"
/home/rafael/git/delphizmq/zmqapi.pas(2799) Fatal: There were 3 errors compiling module, stopping

zmq_proxy from zmq.pas depends on a defined zmq3 in zmq.inc

{$ifdef zmq3}
{*  Built-in message proxy (3-way) *}
function zmq_proxy( frontend, backend, capture: Pointer ): Integer; cdecl; external libzmq;

{$endif} 

GenerateConsoleCtrlEvent(CTRL_C_EVENT... is windows only, isn't it?. Honestly I don't know if it is included in lazarus, but I found a thread with people talking about it.

What should I do??

@cpicanco
Copy link
Contributor Author

So... from this report i think zmq_proxy is not available at all in 2.2.0.
http://upstream.rosalinux.ru/pkgdiff_reports/zeromq/2.2.0_to_3.2.2/changes_report.html

So, I think I should restrict it to the zmq3.

@bvarga
Copy link
Owner

bvarga commented Mar 20, 2015

yeap, zmq_proxy is not available in 2.2, a conditional directive is missing there.

you can omit ZMQTerminate too, it's just for generating a Ctrl+C signal, not crutial.

@cpicanco
Copy link
Contributor Author

Thank you man!!

I have made this two small changes that I think could be a pull request. What do you think??

zmqapi.pas

procedure ZMQTerminate;
begin
  {$ifndef UNIX}
  GenerateConsoleCtrlEvent( CTRL_C_EVENT, 0 );
  {$endif}
end; 

and

procedure ZMQProxy( frontend, backend, capture: TZMQSocket );
var
  p: Pointer;
begin
  if capture <> nil then
    p := capture.SocketPtr
  else
    p := nil;

  {$ifdef zmq3}
  if zmq_proxy( frontend.SocketPtr, backend.SocketPtr, p ) <> -1 then
    raise EZMQException.Create( 'Proxy does not return -1' );
  {$endif}

  //raise EZMQException.Create;
end;   

I think this is good...

zeromq-debian

@cpicanco cpicanco changed the title Linux support? Missing compilation conditionals Mar 20, 2015
@bvarga
Copy link
Owner

bvarga commented Mar 20, 2015

thanks

@cpicanco
Copy link
Contributor Author

For instance, I was able to run zmq 3.5 as well, well done @bvarga !!

@bvarga
Copy link
Owner

bvarga commented Apr 18, 2015

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants