Passing NULL to a c function
- Posted by Mark Brown <mabrown at SENET.COM.AU> Mar 15, 2000
- 592 views
------=_NextPart_000_0007_01BF8EA4.1F8D5500 charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi All. I have a problem with the following wrapper function for Morfit for EU global function Morfit_engine_load_world( sequence world_file_name, = sequence world_directory_path, sequence bitmaps_directory_path, atom = world_mode) -- int Morfit_engine_load_world(char *world_file_name, char = *world_directory_path, char *bitmaps_directory_path, =20 -- int = world_mode) return = allocate_string(world_directory_path), allocate_string(bitmaps_directory_path), world_mode}) end function The above function can be called something like this (and works fine) :- funcval =3D = SER_DEFINED_BEHAVIOR) The problem I have is that I need to call it like this :- Morfit_engine_load_world(NULL,NULL,NULL, EDITOR_MODE); <-- the way you = could call it in C=20 My question is how can I pass the "NULL" pointers using the wrapper. Am = I going to have to do a test and have a function call with the = allocate_string stuff and then another function call for the NULL's?? = (perhaps test the sequences for an empty sequence or something?). Or is = there a "NULL" character I can pass.....??=20 This is beyond my C knowledge. Any ideas would be greatly appreciated. Mark Brown mabrown at senet.com.au =20 ------=_NextPart_000_0007_01BF8EA4.1F8D5500 charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content=3D"text/html; charset=3Diso-8859-1" = http-equiv=3DContent-Type> <META content=3D"MSHTML 5.00.2314.1000" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT size=3D2>Hi All.</FONT></DIV> <DIV> </DIV> <DIV><FONT size=3D2>I have a problem with the following wrapper function = for=20 Morfit for EU</FONT></DIV> <DIV> </DIV> <DIV> </DIV> <DIV><FONT size=3D2>global function Morfit_engine_load_world( sequence=20 world_file_name, sequence world_directory_path, sequence = bitmaps_directory_path,=20 atom world_mode)<BR> -- int = Morfit_engine_load_world(char=20 *world_file_name, char *world_directory_path, char=20 *bitmaps_directory_path, </FONT></DIV> <DIV><FONT size=3D2> =20 bsp; =20 int world_mode)<BR> return=20 bsp; =20 =20 world_mode})<BR>end function</FONT></DIV> <DIV> </DIV> <DIV> </DIV> <DIV><FONT size=3D2>The above function can be called something like this = (and=20 works fine) :-</FONT></DIV> <DIV> </DIV> <DIV><FONT size=3D2> funcval =3D=20 SER_DEFINED_BEHAVIOR)</FONT></DIV> <DIV> </DIV> <DIV> </DIV> <DIV><FONT size=3D2>The problem I have is that I need to call it like = this=20 :-</FONT></DIV> <DIV> </DIV> <DIV><FONT size=3D2>Morfit_engine_load_world(NULL,NULL,NULL, = EDITOR_MODE); =20 <-- the way you could call it in C </FONT></DIV> <DIV> </DIV> <DIV><FONT size=3D2>My question is how can I pass the "NULL" pointers = using the=20 wrapper. Am I going to have to do a test and have a function call with = the=20 allocate_string stuff and then another function call for the NULL's?? = (perhaps=20 test the sequences for an empty sequence or something?). Or is there a = "NULL"=20 character I can pass.....?? </FONT></DIV> <DIV><FONT size=3D2></FONT> </DIV> <DIV><FONT size=3D2>This is beyond my C knowledge. Any ideas would be = greatly=20 appreciated.</FONT></DIV> <DIV> </DIV> <DIV><FONT size=3D2>Mark Brown</FONT></DIV> <DIV> </DIV> <DIV><FONT size=3D2><A=20 > ------=_NextPart_000_0007_01BF8EA4.1F8D5500--