blog
Table des matières
- 2026:
- 2025:
4 billet(s) pour juillet 2026
| Procédure simple augmentation de la SWAP | 2026/07/17 15:49 | Jean-Baptiste |
| Exemple git clone avec Ansible | 2026/07/16 14:47 | Jean-Baptiste |
| Windows exe - Comparaison de fichiers binaires | 2026/07/16 10:25 | Jean-Baptiste |
| Pb git | 2026/07/01 17:36 | Jean-Baptiste |
Notes fichiers so linux - compiled library file - shared object file
Voir :
Lister toutes les fonctions
readelf -W -s /usr/lib/7zip/7z.so nm -D /usr/lib/7zip/7z.so
Notes windows EXE DLL
Voir :
cygwin1.dll
Go lang
Voir aussi (Linux) :
Voir les fonctions présentes dans le DLL
readpe -e msvbvm60.dll
winedump -j export msvbvm60.dll
Voir les DLL liées
i686-w64-mingw32-objdump -p win-cgo-test.exe | grep "DLL Name:"
DLL Name: ws2_32.dll
DLL Name: advapi32.dll
DLL Name: ntdll.dll
DLL Name: kernel32.dll
DLL Name: winmm.dll
DLL Name: msvcrt.dll
Appeler une fonction dans une DLL
Avec Go
En ligne de commande
Voir :
wine rundll32.exe user32.dll,MessageBoxW env LANG="fr_FR.UTF-8" wine rundll32.exe user32.dll,MessageBoxA "Titre de la fenêtre"
Inclure ASM dans Go lang
Voir :
Inclure du C dans Go lang
Voir :
Voir aussi :
Inversement - Inclure du Go dans du C :
package main // #include <stdio.h> // #include <stdlib.h> // // static void myprint(char* s) { // printf("%s\n", s); // } import "C" import "unsafe" func main() { cs := C.CString("Hello from stdio") C.myprint(cs) C.free(unsafe.Pointer(cs)) }
Source : https://pkg.go.dev/cmd/cgo
Création image conteneur - exemple de multi-stage builds
Containerfile
FROM golang:latest as builder WORKDIR /build COPY ./build/main.go ./ # RUN go mod download ENV CGO_ENABLED 0 ENV GOOS linux #RUN CGO_ENABLED=0 go build main.go RUN go build -ldflags="-s -w" main.go FROM scratch WORKDIR /app COPY --from=builder /build/main ./main EXPOSE 8080 ENTRYPOINT ["./main"]
build/main.go
package main import ( "fmt" "net/http" ) func homeHandler(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "Hello World ! \n") } func main() { http.HandleFunc("/", homeHandler) http.ListenAndServe(":8080", nil) }
blog.txt · Dernière modification : de 127.0.0.1
