Forum > General
fpc 3.2.2 - main procedure can not find _mainCRTStartup Symbol
(1/1)
paule32:
Hello,
I would use macro conditions, but I fail.
Below, the code that I use of custom system.pas:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---{$ifdef winexe}procedure main; stdcall; [public, alias: '_mainCRTStartup' ];{$endif}{$ifdef windll}procedure main; stdcall; [public, alias: '_DLLMainCRTStartup'];{$endif}begin PascalMain;end;
with this command line options (in a console batch file):
--- Code: Bash [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---set prjdir=D:\a\TinyRTL\TinyRTL\srcset fpc=ppcrossx64.exeset fpcsrc=^ -Fi%prjdir%\sources\fpc-sys ^ -Fi%prjdir%\sources\fpc-win ^ -Fi%prjdir%\sources\fpc-rtl ^ -Fi%prjdir%\sources\fpc-gnu ^ -Fi%prjdir%\sources\fpc-qt ^ ^ -Fu%prjdir%\sources\fpc-sys ^ -Fu%prjdir%\sources\fpc-win ^ -Fu%prjdir%\sources\fpc-rtl ^ -Fu%prjdir%\sources\fpc-gnu ^ -Fu%prjdir%\sources\fpc-qt set fpcEXEx64=^ -n -Mdelphi -Twin64 -dwindows -dwin64 -O3 -Os -Anasmwin64 -a ^ -dNoRTTI -Xs -g set fpcDLLx64=^ -fPIC -CD -WD -Xm -Xc -Xg set fpcexe=%fpc% %fpcsrc% %fpcEXEx64%set fpcdll=%fpc% %fpcsrc% %fpcEXEx64% %fpcDLLx64% %fpcdll% -dwindll testdll.pas -otest1.dll%fpcexe% -dwinexe test1.pas -otest1.exe
The error that pop out is:
test1.pas(33,36) Error: Entrypoint _mainCRTStartup not defined
marcov:
Seems the maincrtstartup is in sysinit. Seems you have cut down the RTL a bit too much.
paule32:
functions in system.pas:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure fpc_libinitializeunits; [public, alias:'FPC_LIBINITIALIZEUNITS']; compilerproc;begin MessageBoxA(0,PChar('in lib init'),Pchar('oooooo'), 0);end; procedure exe_main; stdcall; public name '_mainCRTStartup';begin MessageBoxA(0,Pchar('in EXE file'),Pchar('info'),0); PascalMain;end;procedure dll_main; stdcall; public name '_DLLMainCRTStartup';begin MessageBoxA(0,Pchar('in DLL file'),Pchar('info'),0); PascalMain;end;
whats happend there:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---{$mode delphi}library testdll; procedure test1dll; stdcall;begin MessageBoxA(0,PChar('lulu'),PChar('info'),0);end; exports test1dll; begin MessageBoxA(0,Pchar('ooooooo'),PChar('info'),0); ExitProcess(0);end.
I can compile the DLL and the EXE, but when I start the EXE, it crashes.
So, the question is: how to create DLL files with FPC 3.2.2 ?
marcov:
I don't know. There are simply too many factors to be able to give an answer to these kind of questions . 3rd party Assembling, linking (3rd party?), cut down RTL.
The only solution if you go this way is find your own answers based on inspecting the assembler output (and/or objdumping/disassembling intermediate files).
Navigation
[0] Message Index