Click here to Skip to main content
15,905,419 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Get Network namnes and there IP ? Pin
Larsson12-Feb-03 5:48
Larsson12-Feb-03 5:48 
GeneralGDI+ and DirectX/direct video output Pin
Roman Nurik6-Feb-03 11:04
Roman Nurik6-Feb-03 11:04 
Question__ftol2 ?? where did it come from? .NET? Pin
Jared Allen6-Feb-03 10:24
Jared Allen6-Feb-03 10:24 
AnswerRe: __ftol2 ?? where did it come from? .NET? Pin
Joaquín M López Muñoz6-Feb-03 10:37
Joaquín M López Muñoz6-Feb-03 10:37 
GeneralRe: __ftol2 ?? where did it come from? .NET? Pin
Chris Losinger6-Feb-03 10:50
professionalChris Losinger6-Feb-03 10:50 
GeneralRe: __ftol2 ?? where did it come from? .NET? Pin
Jared Allen6-Feb-03 11:51
Jared Allen6-Feb-03 11:51 
GeneralRe: __ftol2 ?? where did it come from? .NET? Pin
Chris Losinger6-Feb-03 12:20
professionalChris Losinger6-Feb-03 12:20 
QuestioncreateThread , Prototype, and extren call correctness? Pin
Pecan2046-Feb-03 7:42
Pecan2046-Feb-03 7:42 
My last attempt at launching a fortran dll with
createThread resulted in the following error.

error LNK2001: unresolved external symbol "unsigned long
__stdcall FTREND3(void *)" (?FTREND3@@YGKPAX@Z)
Debug/cinterface3.exe : fatal error LNK1120: 1 unresolved
externals

I am not sure if the extern and DWORD prototypes are
correct? If I comment out the DWORD function prototype it
compiles and links but does not start the integer function.

Does the createThread actually pass the integer argument of 1 or just start the function and then it sees the shared memory?

Can someone comment? Thanks.

Code below:
#include <stdio.h>
#include <string.h>
#include <windows.h>

struct io {
char time[10];
int start;
};
struct io cio;

/* prototype for function */
DWORD WINAPI FTREND3(LPVOID);
//DWORD WINAPI FTREND3(LPVOID pvoid);

//extern "C" long _stdcall FTREND3 ( long );
// declspec(dllimport) for DLL's
extern "C" __declspec(dllimport) long _stdcall FTREND3 (
long );

void main (void)
{
DWORD tid;
HANDLE hThread;
cio.start = 1;

hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)
FTREND3, &cio, 0, &tid);
CloseHandle(hThread);

printf("In c after fortran thread started\n\n");
printf("string = %s\n",cio.time);
}


INTEGER FUNCTION FTREND3 (TIO)
USE DFPORT
IMPLICIT NONE
!DEC$ ATTRIBUTES DLLEXPORT :: FTREND3
TYPE IO
INTEGER START ! if 1 start timer
CHARACTER*10 timeIs
END TYPE IO

TYPE(io):: tio
DO WHILE ( tio%START .EQ. 1)
tio%timeIs = CLOCK ( ) ! Uses DFPORT
tio%timeIs = tio%timeIs // char(0)
write (6,*) 'In fortran after time call'
write (6,*) ' Time = ', tio%timeIs
FTREND3 = 1
ENDDO
FTREND3 = 0
RETURN
END FUNCTION FTREND3
AnswerRe: createThread , Prototype, and extren call correctness? Pin
Joaquín M López Muñoz6-Feb-03 9:13
Joaquín M López Muñoz6-Feb-03 9:13 
GeneralRe: createThread , Prototype, and extren call correctness? Pin
Pecan2046-Feb-03 15:14
Pecan2046-Feb-03 15:14 
GeneralDetect Audio CD Pin
Demian Panello6-Feb-03 7:12
Demian Panello6-Feb-03 7:12 
GeneralRe: Detect Audio CD Pin
Valeria Bogdevich7-Feb-03 2:41
Valeria Bogdevich7-Feb-03 2:41 
GeneralRe: Detect Audio CD Pin
Demian Panello7-Feb-03 6:45
Demian Panello7-Feb-03 6:45 
QuestionRunning a thread in non-paged memory? Pin
Michael D Bray6-Feb-03 6:43
Michael D Bray6-Feb-03 6:43 
AnswerRe: Running a thread in non-paged memory? Pin
Felix Gartsman6-Feb-03 7:15
Felix Gartsman6-Feb-03 7:15 
GeneralControlling the mime types used with CHtmlView Pin
Obliterator6-Feb-03 6:02
Obliterator6-Feb-03 6:02 
GeneralDebugging functions placed in the header file... Pin
Joan M6-Feb-03 5:19
professionalJoan M6-Feb-03 5:19 
GeneralRe: Debugging functions placed in the header file... Pin
Ian Darling6-Feb-03 5:41
Ian Darling6-Feb-03 5:41 
GeneralRe: Debugging functions placed in the header file... Pin
Joan M6-Feb-03 5:51
professionalJoan M6-Feb-03 5:51 
GeneralRe: Debugging functions placed in the header file... Pin
Ian Darling6-Feb-03 6:03
Ian Darling6-Feb-03 6:03 
Generalwhy? Pin
Joan M6-Feb-03 6:17
professionalJoan M6-Feb-03 6:17 
GeneralRe: why? Pin
Joaquín M López Muñoz6-Feb-03 7:12
Joaquín M López Muñoz6-Feb-03 7:12 
GeneralRe: why? Pin
Joan M6-Feb-03 21:25
professionalJoan M6-Feb-03 21:25 
GeneralRe: why? Pin
Joaquín M López Muñoz6-Feb-03 21:30
Joaquín M López Muñoz6-Feb-03 21:30 
GeneralRe: why? Pin
Joan M6-Feb-03 22:03
professionalJoan M6-Feb-03 22:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.