ok. I backed up to a simple version. how I declare the C routine must be the problem, with nothing, procedure HelloC; cdecl; external;
I think it's trying to static link it, and gets an pcode.pas(19,1) Error: Undefined symbol: _HelloC with anything else procedure HelloC; cdecl; external 'HelloC'; it links, but dynamically and then the routine is never found. -------- pcode.pas program pcode; {$MODE OBJFPC} {$R+} uses ctypes, sysutils, dos, math; procedure HelloC; cdecl; external; type UINT8 = 0..255; UINT16 = 0..65535; UINT32 = Longword; begin writeln('Test'); HelloC; end. ccode.cpp #include <stdint.h> #include <stdio.h> void HelloC(void) { printf("Hello \n"); } makeit.bat @set ToolPath=C:\VCAST63\MinGW\bin @set cc=%ToolPath%\gcc.exe @set SAVED_PATH=%PATH% @set PATH=%ToolPath%;%PATH% @set BASE=%cd% %CC% -g -I%BASE% -DGNU_WIN32 -O1 -Wunused-variable -c ccode.c -o ccode.o fpc -MDelphi -MDelphi -vw -Sg -Ci -O1 -Cp386 -OpPENTIUM3 -Ratt ^ -Fu%FPC_BASE%\units\i386-Win32 ^ -Fu%FPC_BASE%\units\i386-Win32\* ^ -Fu%FPC_BASE%\units\i386-Win32\rtl ^ -FlC:\VCAST63\MinGW\lib ^ pcode.pas @set PATH=%SAVED_PATH% @exit /b -- so now I'm back to the error of undefined symbol C:\FPC\use_c_with_pas>fpc -MDelphi -MDelphi -vw -Sg -Ci -O1 -Cp386 -OpPENTIUM3 -Ratt -Fu\units\i386-Win32 -Fu\units\i386-Win32\* -F u\units\i386-Win32\rtl -FlC:\VCAST63\MinGW\lib pcode.pas Free Pascal Compiler version 2.4.4 [2011/04/23] for i386 Copyright (c) 1993-2010 by Florian Klaempfl Target OS: Win32 for i386 Compiling pcode.pas Linking pcode.exe pcode.pas(19,1) Error: Undefined symbol: _HelloC pcode.pas(19,1) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted Error: C:\FPC\2.4.4\bin\i386-Win32\ppc386.exe returned an error exitcode (normal if you did not specify a source file to be compiled ) This is on an evil windows machine thanks for the help guys john -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal