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: Jens Eden <[email protected]>
To: "Ernest L. Williams Jr." <[email protected]>
Cc: [email protected]
Date: Tue, 11 Oct 2005 18:44:15 +0200
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);
}



Replies:
Re: Qt-compatible Channel Access lib Mark Davis
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.

Navigate by Date:
Prev: IP Carrier Board Luchini, Kristi
Next: RE: Asyn build under win32 Mark Bennett
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 Ernest L. Williams Jr.
Next: Re: Qt-compatible Channel Access lib Mark Davis
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 ·