Compiling an OBJ module into a basic program in version 3.5 PowerBasic for DOS 
Author Message
 Compiling an OBJ module into a basic program in version 3.5 PowerBasic for DOS

Hi

I am trying to do the above but am having some wierd errors. When I
try to $LINK the .OBJ module I keep getting undeclared variable
errors. If I declare the variable that is giving me the error PUBLIC
the compiler stops and tells me it can't find the variable. I am using
an .OBJ file compiled with Borland C++ 3.0. I have tried differant
memory sizes for the module but it doesn't seem to matter. I have
named my segments CSEG and DSEG when I compiled it.. The main problem
seems to be PB is saying variables are external when they aren't
declared so. How does PB decide whether a variable in the .OBJ modual
is local or external? Is there a setting I can change in the C++
compiler to fix this? Do I need to declare all the local variables
local and the externals external in the C modual for the PB compiler
to be able to correctly decide which is which? Or does the problem lie
with the C compiler? I read the documents on the powerbasic web site
about linking C moduals but they were using Borland C 2.0. Like I said
in the above I did try the huge memory setting but all that happened
was PB stopped on a differant variable. Thanks for reading.

John



Mon, 07 Jun 2004 08:11:26 GMT  
 Compiling an OBJ module into a basic program in version 3.5 PowerBasic for DOS

Quote:
> Hi

> I am trying to do the above but am having some wierd errors. When I
> try to $LINK the .OBJ module I keep getting undeclared variable
> errors.
>...
> The main problem seems to be PB is saying variables are external when they
aren't
> declared so. How does PB decide whether a variable in the .OBJ modual
> is local or external?

PB does not decide the scope of variables in linked OBJ modules. To access a
variable in a linked module the variable name in that linked module must be
public, and in the main PB program (the program to which you are linking the
OBJ module) the variable must be EXTERNAL.

But... IIRC, PB/DOS will not link an OBJ module with initialized data. (you
will get a "fixup" error when linking).

MCM



Mon, 07 Jun 2004 22:39:52 GMT  
 Compiling an OBJ module into a basic program in version 3.5 PowerBasic for DOS
Hi John,

I can't make any absolute promises, but if you can please send the
code to Tech Support, we'll do our best to try to help you sort out
the issue.

Thanks!

Quote:

>Hi

>I am trying to do the above but am having some wierd errors. When I
>try to $LINK the .OBJ module I keep getting undeclared variable
>errors. If I declare the variable that is giving me the error PUBLIC
>the compiler stops and tells me it can't find the variable. I am using
>an .OBJ file compiled with Borland C++ 3.0. I have tried differant
>memory sizes for the module but it doesn't seem to matter. I have
>named my segments CSEG and DSEG when I compiled it.. The main problem
>seems to be PB is saying variables are external when they aren't
>declared so. How does PB decide whether a variable in the .OBJ modual
>is local or external? Is there a setting I can change in the C++
>compiler to fix this? Do I need to declare all the local variables
>local and the externals external in the C modual for the PB compiler
>to be able to correctly decide which is which? Or does the problem lie
>with the C compiler? I read the documents on the PowerBasic web site
>about linking C moduals but they were using Borland C 2.0. Like I said
>in the above I did try the huge memory setting but all that happened
>was PB stopped on a differant variable. Thanks for reading.

>John

Lance
PowerBASIC Support

-------------------------------------------------------------------------
PowerBASIC, Inc.      | 800-780-7707 Sales | "We put the Power in Basic!"
316 Mid Valley Center | 831-659-8000 Voice | http://www.powerbasic.com



Wed, 09 Jun 2004 01:40:11 GMT  
 Compiling an OBJ module into a basic program in version 3.5 PowerBasic for DOS
Thanks Lance, I went ahead and emailed them. I would really like to
get this linked since it is the Wattcp tcp/ip. Do you have any other
suggestions? I have been trying to link the code section by section.
Do you think it would work a little better if I just compiled the
entire tcp/ip code into all its obj moduals and made up a library and
tried to link it all at once? Right now the PB compiler is reporting
functions as variables. Could it be because the obj code is not
complete? I have never tried to link 'C' moduals to basic before.


Quote:

>Hi John,

>I can't make any absolute promises, but if you can please send the
>code to Tech Support, we'll do our best to try to help you sort out
>the issue.

>Thanks!


>>Hi

>>I am trying to do the above but am having some wierd errors. When I
>>try to $LINK the .OBJ module I keep getting undeclared variable
>>errors. If I declare the variable that is giving me the error PUBLIC
>>the compiler stops and tells me it can't find the variable. I am using
>>an .OBJ file compiled with Borland C++ 3.0. I have tried differant
>>memory sizes for the module but it doesn't seem to matter. I have
>>named my segments CSEG and DSEG when I compiled it.. The main problem
>>seems to be PB is saying variables are external when they aren't
>>declared so. How does PB decide whether a variable in the .OBJ modual
>>is local or external? Is there a setting I can change in the C++
>>compiler to fix this? Do I need to declare all the local variables
>>local and the externals external in the C modual for the PB compiler
>>to be able to correctly decide which is which? Or does the problem lie
>>with the C compiler? I read the documents on the PowerBasic web site
>>about linking C moduals but they were using Borland C 2.0. Like I said
>>in the above I did try the huge memory setting but all that happened
>>was PB stopped on a differant variable. Thanks for reading.

>>John

>Lance
>PowerBASIC Support

>-------------------------------------------------------------------------
>PowerBASIC, Inc.      | 800-780-7707 Sales | "We put the Power in Basic!"
>316 Mid Valley Center | 831-659-8000 Voice | http://www.powerbasic.com




Sat, 12 Jun 2004 19:55:20 GMT  
 Compiling an OBJ module into a basic program in version 3.5 PowerBasic for DOS
Please refer to my reply to your PB Tech Support email...

Thanks!

Quote:

>Thanks Lance, I went ahead and emailed them. I would really like to
>get this linked since it is the Wattcp tcp/ip. Do you have any other
>suggestions? I have been trying to link the code section by section.
>Do you think it would work a little better if I just compiled the
>entire tcp/ip code into all its obj moduals and made up a library and
>tried to link it all at once? Right now the PB compiler is reporting
>functions as variables. Could it be because the obj code is not
>complete? I have never tried to link 'C' moduals to basic before.



>>Hi John,

>>I can't make any absolute promises, but if you can please send the
>>code to Tech Support, we'll do our best to try to help you sort out
>>the issue.

>>Thanks!


>>>Hi

>>>I am trying to do the above but am having some wierd errors. When I
>>>try to $LINK the .OBJ module I keep getting undeclared variable
>>>errors. If I declare the variable that is giving me the error PUBLIC
>>>the compiler stops and tells me it can't find the variable. I am using
>>>an .OBJ file compiled with Borland C++ 3.0. I have tried differant
>>>memory sizes for the module but it doesn't seem to matter. I have
>>>named my segments CSEG and DSEG when I compiled it.. The main problem
>>>seems to be PB is saying variables are external when they aren't
>>>declared so. How does PB decide whether a variable in the .OBJ modual
>>>is local or external? Is there a setting I can change in the C++
>>>compiler to fix this? Do I need to declare all the local variables
>>>local and the externals external in the C modual for the PB compiler
>>>to be able to correctly decide which is which? Or does the problem lie
>>>with the C compiler? I read the documents on the PowerBasic web site
>>>about linking C moduals but they were using Borland C 2.0. Like I said
>>>in the above I did try the huge memory setting but all that happened
>>>was PB stopped on a differant variable. Thanks for reading.

>>>John

>>Lance
>>PowerBASIC Support

>>-------------------------------------------------------------------------
>>PowerBASIC, Inc.      | 800-780-7707 Sales | "We put the Power in Basic!"
>>316 Mid Valley Center | 831-659-8000 Voice | http://www.powerbasic.com


Lance
PowerBASIC Support

-------------------------------------------------------------------------
PowerBASIC, Inc.      | 800-780-7707 Sales | "We put the Power in Basic!"
316 Mid Valley Center | 831-659-8000 Voice | http://www.powerbasic.com



Sun, 13 Jun 2004 21:28:27 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Serial port on PowerBasic 3.5

2. specifications for declaring equates/named constants in powerbasic 3.5

3. Only 3ish days until PowerBasic 3.5 gets here ...

4. PBU problem (with PB 3.5 for DOS)

5. ASM syntax in PB DOS 3.5

6. PB DOS 3.5 32 bit addresses

7. I'm look for Clarion Professionall 3.5 for Dos

8. Win32Forth 3.5 slow to compile

9. Win32Forth Version 3.5 Released (LONG)

10. F-PC 3.5 and MS-DOS 5.0

11. F-PC 3.5 and MS-DOS 5.0

12. F-PC 3.5 and MS-DOS 5.0

 

 
Powered by phpBB® Forum Software