Aaron,
 
GetUnits_IPJ is actually a macro:
 
#define GetUnits_IPJ(A,B,C) IGetUnits_IPJ(A,B,C,sizeof(C))
 
In all functions that return a string, we use a macro to insure that the function is called correctly.  The macro forces you to pass a string variable for "C", because the sizeof() function will give a syntax error on a constant, such as "3".
 
Your example 3 can cause the system to completely fail because the returned string can over-run the constant in "3" into unknown memory.
 
In short, always use the macro versions of all functions that return a string, which is why your example 1 works.
 
Best Regards.
Erik
 
-----Original Message-----
From: Aaron Balasch [mailto:[EMAIL PROTECTED]]
Sent: December 1, 2000 11:41 AM
To: [EMAIL PROTECTED]
Subject: [gxnet]: GetUnits_IPJ syntax confusion

I've been trying to figure out how to create and display a map without having to go to the NEWMAP.GX or the DEFMAP.GX through iRunGX_SYS(). I've been looking at DEFMAP.GXC trying to find out how to do it. I've almost got it working but I'm confused as to the syntax of the GetUnits_IPJ method.
  1. In DEFMAP.GXC, the command is    GetUnits_IPJ(hIPJ, rConv, sTmpl);       and it works
  2. If I change it to GetUnits_IPG(hIPJ, rConv, "3");  i.e. replacing sTmpl by an explicit string, I get an error
  3. If I change it to IGetUnits_IPG(hIPJ, rConv, "3", STR_DEFAULT);  i.e. replacing sTmpl by an explicit string and define the length, it works
  4. If I change it to IGetUnits_IPG(hIPJ, 1.0, "3", STR_DEFAULT);  i.e. replacing rConv by an explicit real number, I get an error.
Can anyone figure out what's going on here? or is my percieved syntax problem mopst likely due to something else that I'm not illustrating here?
 
Aaron Balasch
Sky Hunter Technologies Inc.
Suite 101, 1725 10th Avenue S.W.
Calgary, Alberta T3C 0K1
Phone: (403)228-2175
Fax: (403)244-7955
email: [EMAIL PROTECTED]

Reply via email to