Hello
Im coding mp3 encode / ripping tool and because i have licence to realbasic im gonna make user interface with it Technical part im gonna make with akrip.dll and i have develope it more by my own way now. The meaning is use threads for ripping and encode in the same time and i have thinking to use _beginthread function. In the future im gonna develope that tool to use multicore processors. But now the problem is how to design threading because now all functions in the dll are called by their own way from a realbasic so there is no mainthread at all. How it is possible to plan threads to these functions? Or is it necessary make threading in realbasic?

You mention "realbasic" 3 times, and never mention C.
Are you in the right forum?

But the main thing is how to make threads to dll functions if there is no main thread used. Dll has made by c- language.
Example:
dll include this function

void WINAPI HelloWorld()
{
  int i;
  for(i = 0; i < 5; i++)
  {
    printf("Hello world!!!");
    sleep(2000);
  }
}

Mainprogram.exe call dll and straight to this function. So is it possible to change the function to thread because i dont want to wait the time when function is ready? It totally jam the Mainprogram.exe.

Shouldn't matter in what language your DLL is made, I think you need to figure out how to thread in RealBasic and call the functions from your realbasic program.

try this example DLL: I compiled it but didn't test it

#include <windows.h>
#include <stdio.h>

static DWORD WINAPI myThreadProc(void* parmeter)
{
   while(true)
   {
      printf("Hello world!!!\n");
      Sleep(1000);
      }
   return 0;
}
   
__declspec( dllexport )  int WINAPI HelloWorld()
{
   CreateThread(0, 0, myThreadProc, 0, 0, 0);
   return 0;
}

Ok, thanks. Realbasic is bad because it doesnt have real threads but I will try to find the way solve this with c.

I'm confused -- do you want the threads in RealBasic (whatever that is) or in the DLL? The code I posted will create the threads in the DLL and will work regardless of the language that calls it.

This question has already been answered. Start a new discussion instead.