The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: ossama on December 11, 2007, 08:41:10 PM

Title: long lines in masm
Post by: ossama on December 11, 2007, 08:41:10 PM
hello, i am geting some trouble when i use long lines in the source codes in masm, the assembler shows the error:
error A2041: string or text literal too long
how can i write long lines in masm?

an example of long line in my project is like this:


vtbltcpip Itcpip <pvtIUnknown,tcpip_initialize,tcpip_getblocking,tcpip_setblocking,tcpip_listen,tcpip_accept,tcpip_connect,tcpip_disconnect,tcpip_getremotehostname,tcpip_getremoteipaddress,tcpip_senddata,tcpip_receivedata,tcpip_getsocket,tcpip_setsocket,tcpip_getreadbuffersize,tcpip_processnetworktrafic>


where Itcpip is the structure
Itcpip STRUCT
   Itcpip_QueryInterface      comethod3 ?
   Itcpip_AddRef         comethod1 ?
   Itcpip_Release      comethod1 ?

   Itcpip_Initialize      comethod2 ?
   Itcpip_GetBlocking      comethod1 ?
   Itcpip_SetBlocking      comethod2 ?

   Itcpip_Listen         comethod2 ?
   Itcpip_Accept         comethod1 ?
   Itcpip_Connect         comethod3 ?
   Itcpip_Disconnect      comethod1 ?
   Itcpip_GetRemoteHostName   comethod2 ?
   Itcpip_GetRemoteIpAddress   comethod2 ?

   Itcpip_SendData      comethod3 ?
   Itcpip_ReceiveData      comethod3 ?

   Itcpip_GetSocket      comethod1 ?
   Itcpip_SetSocket      comethod2 ?
   Itcpip_GetReadBufferSize   comethod1 ?
   Itcpip_ProcessNetworkTrafic   comethod3 ?
Itcpip ENDS

i am using COMPONENT OBJECT MODEL in all my programs.
Title: Re: long lines in masm
Post by: Tedd on December 12, 2007, 01:21:43 PM
There's an unfortunate line-length limit - around 265 characters -- depending on the statement, you'll either get "literal too long" or "statement too complex"
In most cases you can fix it be writing out the structure long - with multiple "DD/DW/DB/etc" lines (or "comethod1/2/3" in your case). If that doesn't work for you, you may be able to fix it by renaming/aliasing the names within the structure to make them shorter.
Title: Re: long lines in masm
Post by: ossama on December 12, 2007, 02:09:43 PM
QuoteIn most cases you can fix it be writing out the structure long - with multiple "DD/DW/DB/etc" lines (or "comethod1/2/3" in your case)
yes tedd, iam using this method, but it makes the code not nice.
thank you.