Got an idea when i saw Tiuri's post about HyperThreading and started to think about how threads could be implemented in a game that I and a few friends are planning.
First of all: is i possible to link stuff written i VC++ and PureBasic, and is i possible to thread a function written in VC++ within Purebasic
Second: Is it possible to have VC++ and PureBasic shareing varibels. (PureBasic reading from the same memory as the VC++ Function)
The second must be realy ugly, but as long as it does not crash.
I was thinking about:
VC++
Threaded Function:
repeat
Variabel = Whatever
forever
Threadreturn Function:
Return Variabel
PureBasic:
CreateThread(@Threaded_,0)
Variabel = Threadreturn_()
VC++ in PureBasic with Threads
-
Johan_Haegg
- User

- Posts: 60
- Joined: Wed Apr 30, 2003 2:25 pm
- Location: Västerås
- Contact:
I had such idea and wrote about it in another post (though i was thinking to use LCC and PB). Fasm (used by PB) produces standard objects files so it could be possible to link PB and C objects. Also Fred confirmed that. If C is the main object you should declare a PB function like this:
int _stdcall PBProcedure (VOID);
The only problem I think is how to link static PureBasic LIB files (in case the PB Procedure uses them) as they are not standard object files.
int _stdcall PBProcedure (VOID);
The only problem I think is how to link static PureBasic LIB files (in case the PB Procedure uses them) as they are not standard object files.
-
Johan_Haegg
- User

- Posts: 60
- Joined: Wed Apr 30, 2003 2:25 pm
- Location: Västerås
- Contact:
I've been messing around with mixing C and PB. If you declare your C Functions in such a way:
and output the code to a static library, you can use the tools in the Library SDK folder to create a PureLibrary. All the Functions marked with PB_ will apppear as Commands in PureBasic.
Code: Select all
extern _stdcall DWORD PB_SomeFunction(DWORD fn,DWORD fl)
