wir versuchen gerade die ersten Schritte mit CXP.
Generell läuft bei uns CXP unter Apache.
Jetzt versuchen wir in einem kleinen Project in einer CXP-Datei eine eigene Function aufzurufen, die wir im Project in einerm anderen PRG-File definiert haben und innerhalb einer dynamsichen DLL mit in das Project eingebunden haben. Und das funktioniert nicht.
Definieren wir die eigene Function auch in der CXP-Datei (hier default.cxp), dann können wir diese auch aufrufen.
Dieser Code funktioniert:
Auszug aus einer CXP-Datei
Code: Alles auswählen
<%#Page layout="global.layout" trace="no" %>
<p>
<body>
<h1>@(GetHelloWord())</h1>
<%
? "Heute ist: " + CDow(Date()) + " der " + LEFT(DTOC(DATE()),2) + " " + Monat()
%>
</body>
<%
FUNCTION Monat()
RETURN CDOW(Date())
FUNCTION GetHelloWord()
RETURN "Hallo Welt!"
%>
Auszug aus einer CXP-Datei
Code: Alles auswählen
<%#Page layout="global.layout" trace="no" %>
<p>
<body>
<h1>@(GetHelloWord())</h1>
<%
? "Heute ist: " + CDow(Date()) + " der " + LEFT(DTOC(DATE()),2) + " " + GetMonat()
%>
</body>
<%
FUNCTION GetHelloWord()
RETURN "Hallo Welt!"
%>
Code: Alles auswählen
FUNCTION GetMonat()
RETURN CDOW(Date())
Code: Alles auswählen
[PROJECT]
VERSION = 2.2
Project.xpj
[Project.xpj]
Test1.web
Test2.dll
[Test1.web]
COMPILE = xpp
COMPILE_FLAGS = /q /w
DEBUG = yes
GUI = no
LINKER = ALINK
LINK_FLAGS =
RC_COMPILE = ARC
RC_FLAGS =
HOSTPROCESS = default.cxp
SITE_ROOT = c:\xampp\htdocs\
SITE_URL = http://localhost:80/
// $START-AUTODEPEND
// $STOP-AUTODEPEND
application.config
default.cxp
global.css
global.layout
robots.txt
Test2.lib
[Test2.dll]
COMPILE = xpp
COMPILE_FLAGS = /dll:DYNAMIC /wi /wl /wu /q /w
DEBUG = yes
GUI = no
LINKER = alink
LINK_FLAGS = /dll
RC_COMPILE = arc
RC_FLAGS =
INTERMEDIATE_DEBUG = .debug
INTERMEDIATE_RELEASE = .release
// $START-AUTODEPEND
Utils.obj
// $STOP-AUTODEPEND
Utils.prg
Code: Alles auswählen
<CXP:BuildError/>
Link Error
Description: One or more errors occurred during the link phase of this page. Please review the following specific error details and modify your source code appropriately.
Files:
CXP File: C:\xampp\htdocs\Test1\default.cxp
Intermediate Xbase++ Code: C:\xampp\htdocs\Test1\cxp-application\default.cxp.20200220-57685837.dll
Message(s):
Linker: error ALK2102: unresolved external symbol GETMONAT in Line 0
The linker has detected an undeclared symbol for a function or procedure. Declare the missing function or use the /FORCE option to force ALINK to produce an output file.