EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  <20052006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  <20052006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Qt-compatible Channel Access lib
From: "Mark Davis" <[email protected]>
To: "Jens Eden" <[email protected]>, "Ernest L. Williams Jr." <[email protected]>
Cc: <[email protected]>
Date: Thu, 20 Oct 2005 09:06:25 -0400
First off, thank you Jens for your feedback. Exactly what I needed to make some progress.

A quick update and another question:

For the moment I simply modified the shareLib.h file to define epicsShareFunc as "__stdcall" when compiling Qt applications (I am still using the MinGWwin32 compiler). So far everything works fine with the ca and Com lib calls. Currently using the following functions without (apparent) problems:

 ca_context_create()  (without preemptive callback's)
 ca_add_event()  (with callback)
 ca_create_channel()   (with callback)
 ca_poll()   (aka ca_pend_io - so the non-preemptive callbacks can happen)
 ca_puser()
 ca_clear_channel()
 ca_context_destroy()

Nothing too fancy yet - just setting up a connection and getting callbacks when the value of a PV changes. I haven't tried using preemptive callback yet. Perhaps after I get everything else working the way I want (although if anything is going to cause problems, I expect allowing preemptive callbacks to be it).

My current problem (and I know this is a "newbie" sort of question, but I haven't had to deal with these kinds of details since the early days of windows) is how to similarly modify the epicsShareExtern macro so that references to things like dbr_size[] are resolved at link time. Just having it be "extern" works fine for compiling, but it always shows up as an undefined reference when I link. The same code (and linking with the same libraries) works find on Linux and MacOS/Darwin, so I am assuming it is just a case of the right magic word(s) for the Windows compile/link.

Any ideas?

----- Original Message ----- From: "Jens Eden" <[email protected]>
To: "Ernest L. Williams Jr." <[email protected]>
Cc: <[email protected]>
Sent: Tuesday, October 11, 2005 12:44 PM
Subject: Re: Qt-compatible Channel Access lib



Ernest L. Williams Jr. wrote:
On Tue, 2005-10-11 at 16:25 +0200, Jens Eden wrote:
Mark,

it is possible to link applications compiled with MinGW to
dll-Files compiled with MS Visual Studio.
So in theory it is possible to link your MinGW/QT-Application to Epics
base compiled with MS Visual C++.
No it is not.  We have already gone down this path.  We are dealing with
C++ code and the compiler that you use for building EPICS BASE must be
the same when working with Qt.

We built EPICS BASE with MS C++ and tried to link EPICS libraries with
the GPLd version of Qt which uses MinGW only; did not work.

It works for me, attached is a small code snippet
(it's just a quick and very dirty hack, to show linking and running
ca_array_get() returns ECA_GETFAIL)
which you can compile with the following command (make sure MinGW is in your Path):
g++ -o ca-test.exe ca-test.cpp D:\epics\base-3.14.5\lib\win32-x86\ca.lib


You need the EPICS-dlls in your Path to run it.

That's all I tried, so I don't know, if there are other issues with the
two compilers if developing real world applications.

Did you try to compile the GPLed version of Qt with MS C++?

Jens

*****************
#include <stdio.h>

#ifdef __cplusplus
extern "C" {
#endif
__stdcall int ca_context_create(int);
__stdcall int ca_create_channel(char *, void *, void *, int, void *);
__stdcall int ca_array_get( long, long, void *, void *);
__stdcall int ca_pend_io( double);
__stdcall int ca_flush_io();
#ifdef __cplusplus
}
#endif

# define DBR_DOUBLE 6

int main(void)
{
    int result;
    char *pvname="ringCurrent1";
    char somespace[500];
    void *mychid;
    double doubledata=1.234;

mychid = (void *)somespace;

    result = ca_context_create(0);
    if (result != 1) {
        printf("CA error (%d) ca_context_create \n", result);
return 1;
    }
    result = ca_create_channel(pvname, NULL, NULL, 0, mychid);
    if (result != 1) {
        printf("CA error (%d) ca_create_channel \n", result);
return 1;
    }
    result = ca_flush_io();
    if (result != 1) {
        printf("CA error (%d) ca_pend_io \n", result);
return 1;
    }
    result = ca_pend_io(1.0);
    if (result != 1) {
        printf("CA error (%d) ca_pend_io \n", result);
return 1;
    }
    result = ca_array_get(DBR_DOUBLE, 0, mychid, &doubledata);
    if (result != 1) {
        printf("CA error (%d) ca_array_get \n", result);
// return 1;
    }
     result = ca_pend_io(1.0);
    if (result != 1) {
        printf("CA error (%d) ca_pend_io \n", result);
return 1;
    }

    printf("value: %9.5g\n", doubledata);
}






References:
Qt-compatible Channel Access lib Mark Davis
Re: Qt-compatible Channel Access lib Jens Eden
Re: Qt-compatible Channel Access lib Ernest L. Williams Jr.
Re: Qt-compatible Channel Access lib Jens Eden

Navigate by Date:
Prev: RE: EPICS/Labview shared memory implementation and Labview 8 Purcell, J. David
Next: RE: Qt-compatible Channel Access lib Liyu, Andrei
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  <20052006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Qt-compatible Channel Access lib Jens Eden
Next: RE: Qt-compatible Channel Access lib Liyu, Andrei
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  <20052006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·