Technical Forum

PC-based Automation

WinAC ODK and C++/CLI : Problem with S7SMX_Open

Thread Starter: Jossie   Started: 8/2/2012 12:13 PM   Replies: 2

« Previous thread Next thread »
Page 1 of 1 (3 items)
  8/2/2012, 12:13 PM
Joined 7/12/2007
Last visit: 3/29/2013
Posts: 3
Rating:
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Recently i am trying out the SMX connection of WinAC ODK to see if i can use this for dataexchange between our software and the softplc. The (c++?) examples are working perfectly, however whenever i try to integrate the library in our software i run into troubles with the creating the connection (with the use of function S7SMX_Open), that is as a return value i always get 'S7SMX_ERR_NO_CONTROLLER'. I use the next code :

// Open SMX connection
[DllImport("S7smxx.dll", EntryPoint = "?S7SMX_Open@@YAHKPBDPAPAX@Z", CharSet = ::CharSet::Auto)]
extern "C" S7SMX_ERROR S7SMX_Open(unsigned long dwFlags, [MarshalAs(UnmanagedType::LPStr)] String^ pDeviceName, void* phHandle);


//Open the connection
herr = S7SMX_Open(S7SMX_OPEN_MODE_WRITE, "WinLC RTX", &handle);


I found out that the difference between my project and the vs2008 c++ example projects is the use of common language runtime which is disabled in the examples.

f i enable this in the example projects (for example SMX_DataMemCopy) i run into the same problem, so my best guess here is that there is a problem with the marshalling or the String^ declaration.

Does anyone have any suggestions here, or is there an example of a CLI / C++ project with the function S7SMX_Open used properly?


Thanx, Jos



Top
  8/9/2012, 8:20 AM
Joined 1/26/2011
Last visit: 5/16/2013
Posts: 179
Rating:
Rated: Excellent [4.47 out of 5 / rated 53 time(s)]. (53) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Hello,

did you found any example, yet?
I have no such a example for this.

if you found one, maybe you can send us the link.

greetings bigfoot
Top
  8/9/2012, 5:14 PM
Joined 7/12/2007
Last visit: 3/29/2013
Posts: 3
Rating:
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
No unfortunately no new examples found. Also, the c++ examples present at the WinAC ODK cd do not use the common language infrastructure option (Visual studio), so my guess is maybe  the Siemens developers never tried this or dont have a working example for CLI / C++. Too bad i only have the dll files and not the sources, now debugging is much harder.

Does anyone know how to get into contact with the original developers of WinAC ODK, are they also monitoring this forum?



Regards, Jos



=== Edited by Jossie @ 8/9/2012 5:15 PM [GMT ] ===


Top
Page 1 of 1 (3 items)
Actions