fix C README
This commit is contained in:
		
							parent
							
								
									3dc18a4765
								
							
						
					
					
						commit
						372582cec6
					
				
					 1 changed files with 9 additions and 9 deletions
				
			
		|  | @ -17,19 +17,19 @@ This crate contains C bindings for the `servicepoint` library, enabling users to | ||||||
| #include "servicepoint.h" | #include "servicepoint.h" | ||||||
| 
 | 
 | ||||||
| int main(void) { | int main(void) { | ||||||
|     sp2_Connection *connection = sp2_connection_open("localhost:2342"); |     sp_Connection *connection = sp_connection_open("localhost:2342"); | ||||||
|     if (connection == NULL) |     if (connection == NULL) | ||||||
|         return 1; |         return 1; | ||||||
| 
 | 
 | ||||||
|     sp2_PixelGrid *pixels = sp2_pixel_grid_new(sp2_PIXEL_WIDTH, sp2_PIXEL_HEIGHT); |     sp_PixelGrid *pixels = sp_pixel_grid_new(sp_PIXEL_WIDTH, sp_PIXEL_HEIGHT); | ||||||
|     sp2_pixel_grid_fill(pixels, true); |     sp_pixel_grid_fill(pixels, true); | ||||||
| 
 | 
 | ||||||
|     sp2_Command *command = sp2_command_bitmap_linear_win(0, 0, pixels, Uncompressed); |     sp_Command *command = sp_command_bitmap_linear_win(0, 0, pixels, Uncompressed); | ||||||
|     sp2_Packet *packet = sp2_packet_from_command(command); |     sp_Packet *packet = sp_packet_from_command(command); | ||||||
|     if (!sp2_connection_send(connection, packet)) |     if (!sp_connection_send(connection, packet)) | ||||||
|         return 1; |         return 1; | ||||||
| 
 | 
 | ||||||
|     sp2_connection_dealloc(connection); |     sp_connection_dealloc(connection); | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
| ``` | ``` | ||||||
|  | @ -52,12 +52,12 @@ You have the choice of linking statically (recommended) or dynamically. | ||||||
| 
 | 
 | ||||||
| ## Notes on differences to rust library | ## Notes on differences to rust library | ||||||
| 
 | 
 | ||||||
| - function names are: `sp2_` \<struct_name\> \<rust name\>. | - function names are: `sp_` \<struct_name\> \<rust name\>. | ||||||
| - Use the rust documentation. |  | ||||||
| - Instances get consumed in the same way they do when writing rust / C# code. Do not use an instance after an (implicit!) free. | - Instances get consumed in the same way they do when writing rust / C# code. Do not use an instance after an (implicit!) free. | ||||||
| - Option<T> or Result<T, E> turn into nullable return values - check for NULL! | - Option<T> or Result<T, E> turn into nullable return values - check for NULL! | ||||||
| - There are no specifics for C++ here yet. You might get a nicer header when generating directly for C++, but it should be usable. | - There are no specifics for C++ here yet. You might get a nicer header when generating directly for C++, but it should be usable. | ||||||
| - Reading and writing to instances concurrently is not safe. Only reading concurrently is safe. | - Reading and writing to instances concurrently is not safe. Only reading concurrently is safe. | ||||||
|  | - documentation is included in the header and available [online](https://docs.rs/servicepoint_binding_c/latest/servicepoint_binding_c/) | ||||||
| 
 | 
 | ||||||
| ## Everything else | ## Everything else | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Vinzenz Schroeter
						Vinzenz Schroeter