91
General / Re: How to: create DLL file for Windows 10 64-Bit Pro
« Last post by paule32 on April 18, 2024, 05:00:34 pm »@marcov:
I had written a little test case .c file based test.dll - it will also fail on the write line.
Here the code:
compiled with:
all done.
The printf text's till fwrite will be display on screen.
Then app crashes.
I had written a little test case .c file based test.dll - it will also fail on the write line.
Here the code:
- // note: this code will fail with FILE*, and PFILE, too ...
- # include <stdio.h>
- # include <stdlib.h>
- # include <string.h>
- struct _PFILE {
- char * _ptr;
- uint64_t _cnt;
- char * _base;
- uint64_t _flag;
- uint64_t _file;
- uint64_t _charbuf;
- uint64_t _bufsiz;
- char * _tmpfname;
- }
- PFILE;
- PFILE * my_fopen(char *filename, char *filemode)
- {
- if (tmp == NULL) {
- return 0;
- } return tmp;
- }
- int my_fwrite(char *filename, char *filemode, PFILE *fhandle)
- {
- if (!fhandle) {
- return 0;
- }
- }
compiled with:
- gcc -O2 -fPIC -c test.c
- gcc -shared -fPIC -o test.dll test.o
- # optional: strip test.dll
all done.
The printf text's till fwrite will be display on screen.
Then app crashes.