Thank you.

I am a little unclear on when `-latslib` needs to be linked (at least it 
isn't discussed in the introduction book or tutorial, nor the wiki except 
to say that it should be avoided for portable libraries).

I can see that `fun patsopt_version() = "mac#%"` is an "external global 
name" (treated as a C macro). Is it then required to link `-latslib` 
whenever a definition is of an external global name? i.e. `ext#`, `mac#` or 
`sta#`?

I did also find an implementation in `prelude/DATS/basics.dats` which has a 
simple definition: `implement patsopt_version() = "0.3.2"` which doesn't 
look like an "external" C macro (maybe this definition is unrelated?)

You also mentioned that it was not compiled when generating libatsopt, 
which seems to be a different static library 
`ccomp/atslib/lib/libatsopt.a`, is it necessary to also link this library 
in some cases with `-latsopt` ?

On Wednesday, March 8, 2017 at 5:45:09 PM UTC-8, gmhwxi wrote:
>
>
> Thanks for reporting it!
>
> I fixed the issue and uploaded the changes to GitHub, which should go into
> the next release (ATS2-0.3.4).
>
> By the way, patsopt_version is NOT a template. So one needs -latslib when 
> using it.
> I forgot the need to compile patsopt_version when generating the libatsopt 
> library.
>
> On Wed, Mar 8, 2017 at 7:55 PM, spearman <pearm...@gmail.com <javascript:>
> > wrote:
>
>> Trying to call `patsopt_version` in the following simple program:
>>
>> #include "share/atspre_define.hats"
>> #include "share/atspre_staload.hats"
>>
>> implement main0 () = (
>>   println!(patsopt_version());
>>   exit_errmsg_void (0, "foo\n")
>> )
>>
>> generates the compiler error:
>>
>> /tmp/cc8XdQB8.o: In function `mainats_void_0':
>> patsver_dats.c:(.text+0x181): undefined reference to `
>> atspre_patsopt_version'
>> collect2: error: ld returned 1 exit status
>>
>> and a couple warnings:
>>
>> patsver_dats.c: In function ‘mainats_void_0’:
>> patsver_dats.c:343:1: warning: implicit declaration of function ‘
>> atspre_patsopt_version’ [-Wimplicit-function-declaration]
>>  ATSINSmove(tmp2, atspre_patsopt_version()) ;
>>  ^
>> In file included from patsver_dats.c:15:0:
>> /home/spearman/ats/remote/ATS2-Postiats/ccomp/runtime/pats_ccomp_instrset
>> .h:270:35: warning: assignment makes pointer from integer without a cast 
>> [enabled by default]
>>  #define ATSINSmove(tmp, val) (tmp = val)
>>                                    ^
>> patsver_dats.c:343:1: note: in expansion of macro ‘ATSINSmove’
>>  ATSINSmove(tmp2, atspre_patsopt_version()) ;
>>  ^
>>
>> Commenting out the line to call `patsopt_version` compiles and runs 
>> successfully emitting the exit message.
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "ats-lang-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to ats-lang-user...@googlegroups.com <javascript:>.
>> To post to this group, send email to ats-lan...@googlegroups.com 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/ats-lang-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ats-lang-users/b0b17fed-0eae-4113-95cf-3f93b266571c%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ats-lang-users/b0b17fed-0eae-4113-95cf-3f93b266571c%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ats-lang-users+unsubscr...@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ats-lang-users/4b2cb102-6bd8-40d8-aee1-5268ab46f059%40googlegroups.com.

Reply via email to