|
|
Experimental Physics and
| ||||||||||||||||
|
|
On Tue, 2005-10-11 at 16:25 +0200, Jens Eden wrote:Mark, 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);
}
| ||||||||||||||||
| ANJ, 02 Sep 2010 |
·
Home
·
News
·
About
·
Talk
·
Base
·
Modules
·
Extensions
·
· Distributions · Download · Documents · Links · Licensing · |