One last thing, a make V=1 produces:
$ make V=1make  all-am/bin/sh ./libtool  --tag=CC --silent  --mode=link gcc 
-std=c99 -Wall -Wextra -pedantic -Wmissing-prototypes -Wshadow -g -O2 
-version-info 0:0:0 -no-undefined   -o libserialport.la -rpath /usr/local/lib 
serialport.loC:/Program 
Files/mingw-w64/x86_64-5.1.0-posix-seh-rt_v4-rev0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
 cannot find -linkcollect2.exe: error: ld returned 1 exit statusMakefile:505: 
recipe for target 'libserialport.la' failedmake[1]: *** [libserialport.la] 
Error 1Makefile:412: recipe for target 'all' failedmake: *** [all] Error 2
Perhaps the --mode=link is being misunderstood on my system?   In Linux, I can 
compile the library successfully.

      From: Uwe Hermann <u...@hermann-uwe.de>
 To: Nacho Man <nacho2...@yahoo.com> 
Cc: "sigrok-devel@lists.sourceforge.net" <sigrok-devel@lists.sourceforge.net> 
 Sent: Friday, August 28, 2015 6:18 AM
 Subject: Re: [sigrok-devel] A question or two about libserialport.
   
Hi,

On Thu, Aug 27, 2015 at 09:00:11PM +0000, Nacho Man wrote:
> I'm sorry if this is the wrong mailing list but I couldn't really find one 
> specifically for libserialport.

No problem, this is the correct one, there's no specific one for


libserialport.


> I had some questions about it and was wondering if anyone here could help.   
> I was looking for some examples, in C source code, of how to use it.   I've 
> been reading the API documentation but I've been having trouble figuring out 
> how to build a program using libserialport.
> 
> If I could just figure out how to scan the system for serial ports, I think 
> I'd be able to figure the rest out myself.  I wouldn't think it'd matter, but 
> my program will be compiled on Windows using MinGW64 (32-bit and 64-bit) and 
> Linux using GNU's gcc.  Thanks.And again, if this is the wrong place, I do 
> apologize.

Here's a quick example to get you started, it'll list all ports it can
detect. Tested on Linux, but libserialport also works fine on Windows.
You need MinGW-w64 (the "old" MinGW will not work).

    #include <stdio.h>
    #include <libserialport.h>
    
    int main(void)
    {
            int i;
            struct sp_port **ports;
    
            sp_list_ports(&ports);
    
            for (i = 0; ports[i]; i++)
                    printf("Found port: '%s'.\n", sp_get_port_name(ports[i]));
    
            sp_free_port_list(ports);
    }


Hope that helps, Uwe.
-- 
http://hermann-uwe.de | http://randomprojects.org | http://sigrok.org


  
------------------------------------------------------------------------------
_______________________________________________
sigrok-devel mailing list
sigrok-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to