Skip to main content

Creating a DLL and compiling with C

Notes on creating a DLL and compiling C​

Library​

Source file​

// gcd.c
int gcd(int a, int b){
return !b ? a : gcd(b, a % b);
}

Header file​

// gcd.h
#ifndef TEST_H
#define TEST_H

int gcd(int a, int b);

#endif

Program​

#include <stdio.h>
#include "gcd.h"

int main(void){
printf("%d\n", gcd(24, 36));
}

Compilation​

Creating the DLL​

gcc gcd.c -shared -o gcd.dll

Compile​

gcc main.c -lgcd -L.

Generating Realistic Terrain in Unity

I tried creating realistic terrain in Unity.

Created based on satellite imagery and elevation data from the Geospatial Information Authority of Japan.

Unity Shimabara Peninsula

Next, I'd like to create Kyushu.

Making Printed Circuit Boards with Acetone Transfer

I made a printed circuit board for developing a homemade measuring instrument.

Acetone Transfer​

Print on plain paper with a laser printer, then place the printout on a copper board, wet it with water, and press the paper firmly. Next, apply a small amount of acetone and, from above a clear file, rub the toner onto the copper board with your fingernail to transfer it with acetone. The first time, I used too much acetone and failed. It's just right when it's soaked throughout. I used 100% acetone nail polish remover.

Printed Circuit Board Acetone Transfer

Wash and rub with water to remove the paper.

Etching​

Pour the etching solution into a suitable container and warm the solution to body temperature using a freezer bag filled with hot water for etching. Around 40 to 45℃ seems to be good, but I didn't use a thermometer as it would rust, so I just estimated. Visually confirm that the copper in the unmasked areas has dissolved, then stop etching.

Printed Circuit Board Etching

Dissolving the Coated Parts​

Dissolve the parts masked with toner or permanent marker using acetone. This leaves only the copper in the masked areas, creating the circuit.

Printed Circuit Board Etching

Making a Small Circuit​

I drilled holes and soldered to make a small circuit. It was easier to solder by applying it as if laying it on top of the copper.

Printed Circuit Board Etching