ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Migration to AutoCAD 2008 version

10 REPLIES 10
Reply
Message 1 of 11
Anonymous
839 Views, 10 Replies

Migration to AutoCAD 2008 version

Hi,

I am facing a problem while migrating a object arx application developed in 2002 version to 2008 version.
I am not well versed with C++ concepts.
Can any one help me out as how to fix the below mentioned error?

error C2664: 'acedDefun' : cannot convert parameter 1 from 'char *' to 'const ACHAR *'
error C2664: 'acdbFail' : cannot convert parameter 1 from 'const char [36]' to 'const ACHAR *'
error C2664: 'strlen' : cannot convert parameter 1 from 'ACHAR *' to 'const char *'
error C2664: 'strcat' : cannot convert parameter 2 from 'ACHAR *' to 'const char *'
error C2664: 'CreateProcessW' : cannot convert parameter 2 from 'char [2000]' to 'LPWSTR'
error C2664: 'acedPrompt' : cannot convert parameter 1 from 'const char [49]' to 'const ACHAR *'

Thanks in advance.

Srikanth
10 REPLIES 10
Message 2 of 11
Anonymous
in reply to: Anonymous

Object ARX applications developed for ACAD 2007 and 2008 versions should use wide characters atleast for calling Object ARX functions.

Please have a look at migration guide which you can find with Object ARX 2007 SDK.

Thanks!
KIMI
Message 3 of 11
Anonymous
in reply to: Anonymous

Hi

I downloaded the OBJECT ARX sdk for 2007 version, but could not follow the documentation
If you can help me out how to change char to ACHAR format, it would be of great help. Please look at attached CPP file
You can guide me in just one or two instances, rest of the thing i will try to do it myself.

Hope to see your positive reply

-Srikanth
Message 4 of 11
Anonymous
in reply to: Anonymous

Siri,

What you are asking for is basic c++ win32 question.

Read up on how char* maps to wchat_t and conversion of ASCII to Unicode.

White spaces need to surrounded by _T(" ") macro.

Strlen need to be converted wcslen() etc.

Inspite of using Visual Teefy from AutoDesk we found ourselves doing some
amount of Manual conversion.


--
Jay Balapa
http://jbalapa.blogspot.com



"srir_soft" wrote in message news:5681770@discussion.autodesk.com...
Hi

I downloaded the OBJECT ARX sdk for 2007 version, but could not follow
the documentation
If you can help me out how to change char to ACHAR format, it would be of
great help. Please look at attached CPP file
You can guide me in just one or two instances, rest of the thing i will try
to do it myself.

Hope to see your positive reply

-Srikanth
Message 5 of 11
Anonymous
in reply to: Anonymous

Hi,

I can suggest following approach of making your application compatible with AutoCAD 2007 / 2008:

1. Check character set settings in VS 2005. It should use UNICODE character set.
2. Replace char with TCHAR or ACHAR
3. Replace all string related functions with wide characters related functions. e.g strlen with tcslen or wcslen etc.
4. Wrap literal strings with _T or ACRX_T macro. e.g acedPrintf(_T("ABC"))
5. Use tcslen (TCHAR) where you were previously assuming 1 byte for each character.
6. For other details have a look at MSDN/Autodesk Object ARX related documentation.

Thanks!
KIMI
Message 6 of 11
Anonymous
in reply to: Anonymous

Thanks a lot for all of you,
I am able to solve many of the problems.
Can you please let me know the syntax for converting ACHAR back to CHAR? i encountered one such problem,
for converting CHAR to ACHAR i have used _T and ACRX_T function, but what is the reverse way?

As i mentioned earlier my knowledge in C++ is very very basic. All these days i was programming with VB.NET with basic language, and autolisp. Please don't mind answering this question.

Thanks

Srikanth
Message 7 of 11
Anonymous
in reply to: Anonymous

Have a look at "WideCharToMultiByte" function of Windows 32 APIs?

Thanks!
KIMI
Message 8 of 11
Anonymous
in reply to: Anonymous

You can use the C++ function "wcstombs()"

Joe

wrote in message news:5684550@discussion.autodesk.com...
Have a look at "WideCharToMultiByte" function of Windows 32 APIs?

Thanks!
KIMI
Message 9 of 11
Anonymous
in reply to: Anonymous

Hi Srikanth,
I am also facing the same problem. I am VB.Net programmer, i dont have knowledge about the Autocad also, just my client want to convert the code to support Autocad 2008. In this code they are calling some method in that method i am facing some error.

Code1 -> if (!ads_defun(exfun.name, i))
Code2 -> ads_undef(exfun.name,i);
Code3 -> char *fname;
fname = rbf->resval.rstring;
Code4 -> struct resbuf **rbfp, *rb;
rb->resval.rstring = (char *)malloc(strlen(str) + 1);
Code5 -> strcpy(rb->resval.rstring, str);

Error1 -> error C2664: 'acedDefun' : cannot convert parameter 1 from 'char *' to 'const ACHAR *'
Error2 -> error C2664: 'acedUndef' : cannot convert parameter 1 from 'char *' to 'const ACHAR *'
Error3 -> error C2440: '=' : cannot convert from 'ACHAR *' to 'char *'
Error4 -> error C2440: '=' : cannot convert from 'char *' to 'ACHAR *'
Error5 -> error C2664: 'strcpy' : cannot convert parameter 1 from 'ACHAR *' to 'char *'

I think you also facing the same problem, if you know a solution for this please help me to solve this problem.
I search this error in google i find only 2 url, both are things is your queries.

Thanks in advance.
Message 10 of 11
Anonymous
in reply to: Anonymous

hi,
I am in the process of migrating our application which uses ObjectARX 2004 libraries to ObjectARX 2009 libraries..
All odbc APIs are expecting pointer to char buffer, how to handle odbc APIs like SQLExecDirect after the ACHAR conversion.
whether everytime ACHAR buffer should be converted to CHAR buffer for SQL statement
and CHAR buffer should be converted to ACHAR buffer after SQL query execution using the routines like
MultiByteToWideChar(),WideCharToMultiByte.
Please help me, how to handle this issue in efficient or correct way..

Regards,
Jeeva
Message 11 of 11
Anonymous
in reply to: Anonymous

Hi travimca, I just saw your post!

Try the following 4:
- use TCHAR definitions instead of char; Autodesk ACHAR is actually Microsoft's TCHAR :-).
i.e.:
#include
TCHAR name[20];
acedDefun(name, i);
TCHAR *fname;
fname = rbf->resbal.rstring;

- use all TCHAR functions, instead of char ones [use _tcslen() instead of strlen(), _tcscpy() instead of strcpy(), etc.] and use _T("a happy string") instead of "a happy string".

- use Autodesk functions for memory allocation & deallocation purposes
i.e.:
struct *rb=NULL;
rb = acutBuildList(str, RTNONE);
/* do what you want */
acutRelRb(rb);

- use WideToAnsi()/AnsiToWide() functions to copy between TCHAR and char and vise-versa (in ObjectARX 2007+ UNICODE is defined):
#ifdef UNICODE
#define WideToAnsi(src,dst) WideCharToMultiByte(CP_ACP,0,src,-1,dst,lstrlen(src)+1,NULL,NULL)
#define AnsiToWide(src,dst) MultiByteToWideChar(CP_ACP,0,src,-1,dst,strlen(src)+1)
#else
#define WideToAnsi(src,dst) strcpy(dst,src)
#define AnsiToWide(src,dst) strcpy(dst,src)
#endif

Regards,
yannis

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost