News:

Download Pelles C here: http://www.pellesc.se

Main Menu

Recent posts

#71
Beginner questions / Re: Importing a function from ...
Last post by Vortex - June 27, 2026, 10:02:33 PM
Hi jm,

The .h file, the header file contains the prototypes of the functions exported by your DLL. Strictly, you don't need a header file. All what you need is to translate correctly your function prototypes in that language to C.

As an example, consider the source code of this simple FreeBASIC DLL named testdll.dll :

Function sum Cdecl Alias "sum" (Byval x As Integer, Byval y As Integer) As Integer Export
   
    Return(x+y)
   
End Function

Function subs Cdecl Alias "subs" (Byval x As Integer, Byval y As Integer) As Integer Export
   
    Return(x-y)
   
End Function

Pelles C code with the function prototypes :

#include <stdio.h>

extern int __cdecl sum(int x,int y);

extern int __cdecl subs(int x,int y);

int main(void)
{
printf("70 + 30 = %d\n",sum(70,30));
printf("70 - 30 = %d",subs(70,30));
return 0;
}

#72
Beginner questions / Importing a function from a DL...
Last post by jm - June 27, 2026, 07:50:22 PM
This is purely a research exercise on my part with limited knowledge.  I'd be grateful if someone could tell me if there's a way in which I can import a function from a Windows DLL that I created using a non-C language compiler on Windows.

The other language compiler has understandably given me only a .DLL and a .LIB but the examples I've seen, where a DLL is used within C, appear to show a .H header is needed.  What should I create in the .H file, or is there another way?

The DLL I created is called JDL.DLL and it contains a function called myfunction() to accept a float value and return the result also as a float.  Can anyone help with this please, thanks.
#73
Work in progress / Re: New Task Schedule 2.0 exam...
Last post by John Z - June 26, 2026, 04:23:26 AM
Here is plain C working code to schedule a task.  It is implemented in my upcoming version of the calendar which already has a vbs task scheduler and a powershell task scheduler, now has a C task scheduler...covering my basis  ;)

I like to mention that it uses TimoVJL's Variant setup (which I did not know how to do) THANKS Timo!

Example inputs are also provided within the code at various places. Look for //EX:

Source code attached . . .

It is a complete working 'one time' scheduler, just created the names structure and fill in that should be most all of the work.

If needing a daily or some repeated schedule look at TimoVJL's code near the top of this stream, he's done it.

John Z

See next post -
#74
User contributions / Re: SMBIOS info
Last post by TimoVJL - June 23, 2026, 04:06:42 PM
Nice tool  :D
#75
User contributions / Re: SMBIOS info
Last post by John Z - June 21, 2026, 10:55:34 PM
Thanks Pelle,

Very informative.  I had no idea that 5GigHz was the max turbo speed of my 'travel laptop'. 
Windows only reports the leisurely 1.7GHz.

A very tiny, partial sample, of one of the output sections of the program to spark interest.
Processor Information (Type 4)
Type............................: 4
Length..........................: 48
Handle..........................: 4
Socket Designation..............: 1 => "U3E1"
Processor Type..................: 3 => 'Central Processor'
Processor Family................: 198 => 'Intel(R) Core(TM) i7 processor'
Processor Manufacturer..........: 2 => "Intel(R) Corporation"
Processor ID....................: 0xbfebfbff000b06a3
Processor Version...............: 3 => "13th Gen Intel(R) Core(TM) i7-1355U"
Voltage.........................: 0b10001010
External Clock..................: 100 MHz
Max Speed.......................: 5000 MHz
Current Speed...................: 4257 MHz
Status..........................: 0b1000001
Processor Upgrade...............: 65 => 'Socket BGA1744'
Best to direct the prodigious output to a text file for easy viewing. smbios.exe > HP_Bios.txt

John Z
#76
User contributions / Re: SMBIOS info
Last post by Pelle - June 21, 2026, 08:52:37 PM
Thanks. Maybe it can lead to something more, some day.
#77
User contributions / Re: SMBIOS info
Last post by Vortex - June 19, 2026, 09:37:59 PM
Hi Pelle,

Nice addition to the toolbox of Pelles C coders, thanks.
#78
User contributions / SMBIOS info
Last post by Pelle - June 18, 2026, 10:21:11 PM
Nothing fancy, just a program I wrote last year to dump info about my BIOS settings (to the console).
Incomplete in many ways. Maybe useful to someone...?
#79
Assembly discussions / Re: Combining object files
Last post by Pelle - June 18, 2026, 08:37:54 PM
OK. I still don't see the point in having a tool that combines object files, but never mind. Not important.
#80
Assembly discussions / Re: Variadic functions
Last post by Vortex - June 14, 2026, 09:46:07 PM
Simple printf emulator using only the bare percentage symbol to represent strings :

.386
.model flat,stdcall
option casemap:none

includelib \PellesC\lib\Win\kernel32.lib
includelib \PellesC\lib\Win\user32.lib

ExitProcess PROTO :DWORD

printfX PROTO C format:DWORD,args:VARARG

.data

format1 db 'This is a % % to % %',0
str1    db 'printfX',0
str2    db 'demo',0
str3    db 'type',0
str4    db 'strings.',0

.code

start:

    invoke   printfX,ADDR format1,
             ADDR str1,ADDR str2,
             ADDR str3,ADDR str4
             
    invoke   ExitProcess,0

END start